Reputation: 83
I have four buttons on the page, when I click on one of them i want it to be highlighted.
The buttons are used to pass data to a controller. They are like this:
<button name="region" id="region" type="button" onclick="window.location='/project/Viewdata/index/region/1'" class="current">ALL</button>
<button name="region" id="region2" type="button" onclick="window.location='/project/Viewdata/index/region/2'" class="current">1st</button>
Upvotes: 3
Views: 14691
Reputation: 864
check this JSFiddle
basically, you bind a highligt effect to the button with jQuery, when clicking it like this
$('button').click(function() {
$(this).effect( "highlight", {color: 'red'}, 3000 );
});
NOTE: As said in the comments, you should never have 2 elements with the same id on one page. If you want to use the same descriptor, use class
instead of id
Upvotes: 4