53
rated 0 times
[
55]
[
2]
/ answers: 1 / hits: 34394
/ 12 Years ago, wed, october 17, 2012, 12:00:00
I am trying to update the text of a button when it is clicked. I have a number of buttons with the same class but no id. Why doesn't this work?
<input type=button class=add-button value=Default />
<input type=button class=add-button value=Default />
<input type=button class=add-button value=Default />
<input type=button class=add-button value=Default />
$(document).ready(function() {
$('.add-button').click(function() {
alert('clicked');
$(this).html('Changed');
});
});
The alert is triggered, but the button isn't changed.
More From » jquery