I’m looking for some kind of change event but for non-forms elements.
Problem:
I have a table where tr tags are changing dynamicly by another script. Tr elements are changing from display:block to display:none or vice versa.
And I need something like this:
event will listing for change of any tr in my table (not matter to display none or block) and after any change the script will check if all trs are set as display:none and if true then do something.
DOM changes like that do not trigger events. Your options are to either update the code that modifies the DOM to also send a custom event, or to poll for changes. The first option is simplest to implement and can look something like this:
The poll option will be slower and is not recommended. Minimal example:
this will check your table every 500 milliseconds.