dynamic - Can I modify this script to work with multiple DIV tags? -


here current code:

var text = ['foo', 'bar', 'baz'];     = 0,     $div = $('#mydiv');  setinterval(function () {     $div.fadeout(function ()     {         $div.text(text[i++ % text.length]).fadein();     }); }, 1000); 

can show me how make work multiple div tags on same page? right works one.

erik

it's not entirely clear you're trying do, maybe like:

//get div elements given classname divs = document.getelementsbyclassname("mydivclassname");  //for each div, apply update on timer setinterval(function () {     (var index = 0; index < divs.length; index++) {         var div = divs[index];         div.fadeout(function () {             div.text(text[i % text.length]).fadein();         });     }     i++; }, 1000); 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -