$('.mybutton').click(function(){ alert($(this).attr("id")); //get the id $(this).attr("disabled", "disabled"); //disable the clicked button });
On May 6, 3:33 am, Adwin Wijaya <[EMAIL PROTECTED]> wrote: > Hi > > I got a problem ... I have more than 1 buttons and each buttons has > unique name. > I assign / bind the button with function like this : > > $('.mybutton').bind('click',function(btn){ alert( btn.id); } ); > > every time i click on the buttons the alert always show undefined. How > to get the ID of button who clicked ? i want to get the id, change the > button to disabled ... how to do that one ... > > and what is event.data actually is > > thanks !