Get the id of the button currently clicked using this.id

  • 2020-03-30 02:22:49
  • OfStack

 
function getid(id) { 
alert(id); 
} 
<input id="btn1" type="button" value="test" onclick="return getid(this.id)" /> 

Related articles: