KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to be add the following to a a page: When a div is clicked, I want to: change the background color of the clicked on div for a few seconds revert back to the original background color after a few seconds I want to do this by using only jQuery available functions - i.e. not using a plugin or anything else. I am relatively new to jQuery, but I think a possible solution involves the use of changing the class of the selected div and using a timer. I am not sure how to put it all together though. Can anyone provide a few lines that show how to do it? This is what I have so far: $(function(){ $('div.highlightable').click(function(){ //change background color via CSS class $(this).addClass('highlighted); //set a timer to remove the highlighted class after N seconds .... how? }); });
Tags (comma-separated)
Save Edits
Cancel