> I have a bunch of anchors that look like this: > ############ > < a href="" class="clicker" id="click_1">click here</a> > < a href="" class="clicker" id="click_2">click here</a> > < a href="" class="clicker" id="click_3">click here</a> > ############# > > The my jquery code looks like this: > > ############# > $("a[class=clicker]").click(function() { > do_something(id);}) > > ############# > > do_something() needs the id of the button clicked. So if I clicked on > the second anchor, I need "click_2" to be passed to do_something(). > How di I do this in jQuery?
$("a[class=clicker]").click(function() { var id = this.id; do_something(id); });