Advertisement
Liliana797979

05. Notification - js advanced

Feb 20th, 2022
626
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. function notify(message) {
  4.   let notificationDiv = document.getElementById('notification');
  5.   notificationDiv.textContent = message;
  6.   notificationDiv.style.display = 'block';
  7.  
  8.   let dataNotificationAttribute = notificationDiv.getAttribute('data-notification-set');
  9.   if(dataNotificationAttribute !== 'true') {
  10.     notificationDiv.setAttribute('data-notification-set', 'true');
  11.     notificationDiv.addEventListener('click', notificationDivClickHander);
  12.   }
  13.  
  14.   function notificationDivClickHander(e) {
  15.     let notificationDiv = document.getElementById('notification');
  16.     notificationDiv.style.display = 'none';
  17.   }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement