jquery - data value of input button inside a form -
Shows two forms with the input button, how do I get the value of the input button?
& lt; Link rel = 'stylesheet' href = 'css / nook.css' type = 'text / css' media = 'screen, projection' /> & Lt; Script type = "text / javascript" src = "js / jquery-1.10.2.min.js" & gt; & Lt; / Script & gt; & Lt; Script & gt; $ (Document) .ready (function () {$ ("post_comment") Submit (function (e) {e.preventDefault (); var s = $ ("comment"). Data ('I'); alert (S);});}) & lt; / Script & gt; & Lt ;? For Php ($ i = 0; $ i & lt; 2; $ i ++) {resonant "
You must search the input element Which is inside the submitted form
$ (document) .ready (function () {$ (".post_comment"). Submit (function (e) {e.preventDefault (); var S = $ (this) .find (". (". "); Data ('I'); Alert (s); var value = $ (this) .Finded (" Comment "). Val (); Alert (Value);});})
There is a spelling mistake in your markup, should be class = 'commment'
class = 'comment '
- There are 3
alert ()
Comments
Post a Comment