I have some HTML codes:
<input type="button" id="btn1" class="myButton" value="Button 1"/>
<input type="button" id="btn2" class="myButton" value="Button 2"/>
I need to run a jQuery function whenever user click each button, and I have to do it using their class.
$('.myButton').click(function() {
// do something
});
But what I should to do, depends on the current element Id.
My question is that how can I detect which element called this function? I need to know its id.