Highlight by breaking the div into page load (without using the jQuery user interface)

I just need to highlight the div by changing its background color for just a moment when the page loads. I do not want to include a jQuery UI plugin just for this.

Is there a way to do this simply using pure jQuery 1.4?

+4
source share
2 answers

Maybe something like this

HTML: <div id="div1" class="someclass">Text</div> JQuery: $("div.someclass").css("background-color":"red"); 

or

 $("#div1").css("background-color":"red"); 

I often use this to make sure the script matches the right element or element.

0
source
 $("div").addClass("highlight"); setTimeout(function() {$("div").removeClass("highlight");}, 500); .highlight { background: red; } 
+3
source

All Articles