S
S
Stacy None2018-03-29 18:23:48
JavaScript
Stacy None, 2018-03-29 18:23:48

How to create a script to check content for changes and output text?

Please help me to make a script that would check a div with a certain css class or id for changes.
For example:
I have a div class=listen
. Records for the last 24 hours are displayed there.
It is necessary that the script checks this div and if an entry is added to this div, that is, an item is added, then the script displays the word "new" by a certain div div=info displays the word new! And the inscription is removed after 24 hours if there are no changes. Thanks in advance to everyone who pays attention!
<a href="/">Запись</a>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alexalexes, 2018-03-29
@alexalexes

It displays records for the last 24 hours.

You have a selection of records fresh in 24 hours. They will all be new.
Under such conditions, it makes no sense to mark them.
If you need to understand what's new between listviews (with an interval of less than 24 hours), then you just need to solve the problem (with the help of cookies) how to keep a timestamp of when the list was viewed, and what action counts as a listview.
When listing again, look at the date of each entry, if the entry is newer than the date of the previous view, then this is new.
If there is no way to get the date of the entry, then you will have to somehow identify each entry and store the "viewed" flag. What will not have the "seen" flag when the list is re-parsed will be new.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question