javascript onclick button by id code example
Example 1: 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>
Example 2: javascript click button by id
var button = document.getElementById("button");
button.click();