javascript - Find Id of clicked button -
I wanted to get the ID of the clicked button because I have 4-5 buttons on my form.
& lt; Button type = "submit" style = "height: 30px" id = "btn help" name = "btn support" onclick = "ShowHelp (2); return back;" & Gt; Help & lt; / Button & gt; & Lt; Button type = "button" style = "height: 30px" id = "btnclose" name = "btnclose" onclick = "close (); return back;" & Gt; Close & lt; / Button & gt; & Lt; Button type = "button" style = "height: 30px" id = "btn save" name = "btn save" onclick = "save (); return back;" & Gt; Close & lt; / Button & gt; ............................... Any button can be clicked, I just want to get that button's ID.
$ (function () {var id = $ (this) .attr ('id'); Alert (id);}) with it Also
$ ("Input"). Click (function (event) {var urlid = $ (this) .attr ('id') warning (urlid);}) but I'm getting undefined as alert is.
How can I click the ID button?
Please help me
Try
Select All Elements of Button Elements and Type Button
$ (": button"). Click (function (event) {var urlid = this.id; alert (urlid);});
Problem $ ("Input") - & gt; Select elements with tag input example. & lt; Input type = "text" / & gt; but & lt; Button & gt; tag
Comments
Post a Comment