javascript display id of clicked element code example
Example 1: how to get the id of button clicked in jquery
$("button").click(function() {
alert(this.id); // or alert($(this).attr('id'));
});
Example 2: get id of clicked element javascript
<button id="3" onClick="reply_click(this.id)">B3</button>
<script type="text/javascript">
function reply_click(clicked_id)
{
alert(clicked_id);
}
</script>