<!DOCTYPE html><html><head><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"> </script><script>$(document).ready(function(){$(".clshlpbtn").on('click',function(e){var id = $(e.target).attr('id');alert("The id of the button that was clicked: "+id);$.post("demo_test_post.asp",{name: "Donald Duck",city: "Duckburg"},function(data,status){
//parsing the data should come here://var obj = jQuery.parseJSON(data);//$("#"+id).val(obj.name);//etc.
if (id=="btnhlp-1")$("#"+id).attr("style","color:red");$("#"+id).val(data);});});
});</script></head><body>
<input type="button" class="clshlpbtn" id="btnhlp-1" value="first btn"> </input><br /><input type="button" class="clshlpbtn" id="btnhlp-2" value="second btn"> </input><br /><input type="button" class="clshlpbtn" id="btnhlp-9" value="ninth btn"> </input>
</body></html>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="testDiv"> When button will click you'll get this id value </div><button id="button"> Button </button>