HTML Code:
Jquery Script:<input type="button" value="button" id="btn"/>
Output:<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('body').on('click', 'input[type=button]', function () {
alert(this.id); // <-- this refers to current clicked input button
});
});
</script>

No comments:
Write comments