Using the name "btn" for the event function parameter will surely make things confusing - because you'll be looking for it to be a DOM element for the button, which it isn't. The parameter to the event function is an *event* object.
Inside the function, "this" refers to the button element, and so does "event.target". -Mike > From: motob > > The best way to see what the btn object is all about is to > download and install firebug. Then use the console to output > that object. for > example: > > $('.mybutton').bind('click',function(btn){ console.log( btn); } ); > > > Then on the console panel of firebug, you'll see the btn > object, which is clickable. If clicked, firebug will show you > the DOM representation of that object and all of its > properties that are accessible. > > On May 6, 9:22 am, Adwin Wijaya <[EMAIL PROTECTED]> wrote: > > Thanks .. but I still curious what is inside the variable > that passed > > through function callback (btn in my example) and how to > have access > > on it. > > > > On May 6, 6:39 pm, motob <[EMAIL PROTECTED]> wrote: > > > > > $('.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 ! >