I have a form where the class of the button is dynamically changing, depending up where the request is coming from. I am trying to capture the onclick event, but it does not tak
You can try adding the click functionality directly to the button when the DOM loads, and just use .hasClass()
to check if the newClass has been applied or not.
$('.button').click(function() {
if($(this).hasClass('newClass')) {
//Code for new class click
alert('test');
}
});
JSFiddle: http://jsfiddle.net/yRySK/1/