How to reload JS document?

Good day!

There is an HTML document that using AJAX lists from the database.
This list is linked to certain scripts when you hover over a list item.

Also on the website there are options for adding new list items by registering in the database. Then the old list displayed in the HTML is deleted, and displays the new updated.

But after that, stop running scripts when you hover over the list items.

I understand this is due to the fact that it was modified DOM tree, and as it were, new elements he sees.
This begs the question, how do I get the JS script to see the new items without reloading the page?

Thank you all in advance!
June 10th 19 at 15:39
1 answer
June 10th 19 at 15:41
Solution
This begs the question, how do I get the JS script to see the new items without reloading the page?
The easiest way is to use something like:
$(document).on('mouseover', '.element_class', function(){
doSomeStuff();
})
that is, to hang an event handler on the document and track the class entering in the event. It is recommended only in case of dynamic creation of elements that would not clutter up the global document feature extra listenername.

Find more questions by tags AJAXJavaScript