Hi All,
I'm newbie to CSS and jquery.
I have a few buttons with the Bootstraps CSS class 'btn btn-primary'. When
a button is clicked I replace the CSS of that button from 'btn btn-primary'
to only 'btn' so the user is able to know what button was clicked (using
jquery).
My problem is that when a second button is clicked the previous clicked
button does not change its CSS back from 'btn' to 'btn btn-primary''.
How can I achieve aforementioned behavior please?
here is the relevant code:
jquery
$( document ).ready(function() {
$('.btn').click(function () {
$(this).removeClass('btn btn-primary');
$(this).addClass('btn');
});
});
buttons
<button id="mybtn1" class="btn btn-primary">My Button1</button><br /><br />
<button id="mybtn2" class="btn btn-primary" onclick="func(this.id)">My
Button2</button>
Thanks in advance
Yaron.
--
You received this message because you are subscribed to the Google Groups
"twitter-bootstrap" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.