Page 2 of 2

Re: When a string inside a div changes do something

Posted: Sat Apr 17, 2010 5:02 pm
by Eran
what's the content of the setInterval callback...

Re: When a string inside a div changes do something

Posted: Sat Apr 17, 2010 5:09 pm
by klevis miho
I don't really know what to put in the function.

Re: When a string inside a div changes do something

Posted: Sat Apr 17, 2010 5:14 pm
by Eran
It should be something like this:

Code: Select all

//Set the start value (could be empty)
var title = document.getElementById('cc_stream_info_song').innerHTML;

function check() {
      var currentTitle = document.getElementById('cc_stream_info_song').innerHTML;     
      if(title != currentTitle) {
            //get artist information
            title = currentTitle; //Update the variable to the current content
      }
}
setInterval(check, 10000);

Re: When a string inside a div changes do something

Posted: Sat Apr 17, 2010 5:23 pm
by klevis miho
Aaaaaaaa much much more simpler then thought.
Thnx again :) .

Re: When a string inside a div changes do something

Posted: Sun Apr 18, 2010 5:39 am
by klevis miho
I tried it and worked perfectly.