I wanted to get the id of clicked button since i have 4-5 buttons on my form.
Solution 2:
I'd try to replace this with the event triggerer.
var urlid = $(event.target).attr("id");
Copy
Also, probably your onclick function is preventing your script to be executed, because it's handling the click event, not letting your function do it.
Solution 3:
I ditched the onclick attributes of buttons you have, and hooked click events to button rather than input, and it worked. So check whether you are connecting to the right element.
See example here.
Solution 4:
<script>jQuery(":button").click(function (event) {
var urlid = $(this).attr('id')
alert(urlid);
})
</script>Copy
Try this its work
Solution 5:
very simply:
$("input").click(function (event) {
var urlid = this.id;
alert(urlid);
})
Copy
for button:
$("button").click(function (event) {
var urlid = this.id;
alert(urlid);
})
Copy
Post a Comment for "Find Id Of Clicked Button"