Answers for "get id of clicked element javascript"

10

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>
Posted by: Guest on March-26-2020
1

how to get on click id in event

<button id="1" onClick="reply_click(this.id)">B1</button>
<button id="2" onClick="reply_click(this.id)">B2</button>
<button id="3" onClick="reply_click(this.id)">B3</button>
    
<script type="text/javascript">
  function reply_click(clicked_id)
  {
      alert(clicked_id);
  }
</script>
Posted by: Guest on January-07-2021

Code answers related to "get id of clicked element javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language