benhowdle89 benhowdle89 - 1 year ago 97
jQuery Question

jQuery find ID of clicked button by class

I have numerous buttons on my page with the same class names. However these buttons have different ID's. How do i do this:

var id = $(this).{ID OF CLICKED BUTTON};

How can i make this pseudo code work?


Answer Source
     var id =;

The ID is accessible directly from the element. There's absolutely no need to use a jQuery method.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download