onclick alert clicked element

<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>

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
how to get on click id in event get id of element click event javascript click event get id of element javascript javascript get id from click event how to get id from click event javascript get id of clicked element eventlistener javascript onclick get elemetn id javascript get id onclick js get id on click how to get element id on click on click get element id how to get id of clicked even javascript js get the id of the event button click get element id from click event javascript function get id of clicked element js on click get element id javascript onclick event get id how to get id onclick in javascript javascript get the event id from a button click get element id when clicked javascript how to get element id onclick in javascript javascript click event get element id javascript get element by id click event get id onclick javascript addEvent on click id get element id on click how to get the id of an event click javascript on click event where i can get the id of an element onclick event get id js get id of element clicked fun a function when button tag is clicked javascript get value of id button jquery get id and click rhis id on click event get div from clicked button go to the element by id on click js get element id on click get button that was clicked javascript js check on click if el has id javascript get element id on click javascript get id of object clicked javasctipt onclick with this.id get id of clicked element javascript button click of value get by button id get clicked element jquery id how to get id of button clicked in javascript javascript button id onclick
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source