Use this inside the onclick js and jquery

<input type="button" value="click" class="mybtn" onclick="myFun(this)">

<script>
function myFun(e){
 var classVal= $(e).attr('class');
  alert(classVal);
  
}
</script>

Comments