How to detect which submit button is clicked in jquery -


If I have 2 forms on my button, then can be detected as to which clicked In Jquery?

  & lt; Input name = "submit" type = "submit" value = "button1" & gt; & Lt; Input name = "submit" type = "submit" value = "button2" & gt;   

It is constantly returning "button1"

  warning ($ ("input [name = submit]"). Val ());    

You do not need unique IDs to use your supplied HTML :

  $ ("input [type = submit]"). Click (function () {warning ($ (this) .val ());}); Edit   

I believe that you should rename on one of the buttons

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -