I am trying to get some flashing effect by jQuery. Please help. Here is the not-working code.
Javascript:
jQuery(document).ready(function(){
var flashThis = function(){
var className = $('#annoying').attr('class');
if(className.indexOf("blueOne") !== -1) {
jQuery("#annoying").removeClass("blueOne");
}
if(className.indexOf("blueOne") === -1) {
jQuery("#annoying").addClass("blueOne");
}
flashThis();
}
flashThis();
});
CSS:
.whiteOne {
color:#FFFFFF;
}
.blueOne {
color:#0000FF;
}
HTML:
<p id="annoying" class="whiteOne">I will flash.</p>