Monday, 12 August 2013

Jquery - Change Button Function

Jquery - Change Button Function

I am new to JQuery and I'm trying to write code that changes a clicked
button both in text and function. Here is the code:
$('.button1').click(
function() {
$(this).val('Button2');
$(this).removeClass('button1').addClass('button2');
}
);
$('.button2').click(
function() {
alert('Button 2 Clicked');
}
);
The problem is, the second event does not fire and call the alert.
Thanks in advance

No comments:

Post a Comment