To show a notification when an element is added to page we can use createElement() method creates an element list with the specified name. After that, we will create a text node by createTextNode() method.Then we will append the new elemet in that list and use the alert() function to show a notification to the user.
Below example illustrate the approach:
Example: In this example, we already have a list so we want another element in that list, but when we want to add an element in that list, we will show a notification alert when we click the button to add an element in that list.
- How to get daily weather notification on mobile using Node.js and Twilio API ?
- How to get history changes notification via history.pushState() method ?
- How to display search result of another page on same page using ajax in JSP?
- How to show Page Loading div until the page has finished loading?
- How to redirect a page to another page in HTML ?
- How to pass form variables from one page to other page in PHP ?
- How to count number of notification on an icon?
- How to load notification alert on top right corner without click of button in bootstrap ?
- How to play a notification sound on websites?
- Bulma | Notification
- ReactJS Toast Notification
- How to set custom media notification with amp-audio in Google AMP ?
- How to get the size of screen, current web page and browser window using jQuery?
- How to get title of current HTML page using jQuery ?
- How to get focused a button automatically when the page load using HTML ?
- How to get the title of an HTML page ?
- Python program to crawl a web page and get most frequent words
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.