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

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -