javascript - jQuery php variable problems -


I am trying to capture the correct variable in this jQuery function, but the button I click, the warning is always the name Shows I have the first label that I have a thought? Thank you.

  & lt; Html & gt; & Lt; Top & gt; & Lt; Script type = "text / javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {$ (". Submit") (function () {var name = $ ("# name"). Val (); alert (name);})}}; & Lt; / script & gt; & lt; / head & gt; & lt; body & gt; & lt ;? php included ("connection.php"); $ link = connect (); $ result = mysql_query (" Name (* result), $ link); if (mysql_fetch_array ($ result) == 0) {resonant "no names are registered"} and {while {$ row = mysql_fetch_array ($ result)) {resonance "& lt ; Html> gt; & lt; label & gt; $ Line ["name"] "Input type = 'button' class = 'submit' value = 'delete' & gt; & lt; input type = 'hidden' id = 'name' value =". $ Line ["name"]. "& Gt; 
} Mysql_free_result ($ result); Mysql_close ($ link); }? & Gt; & Lt; / Body & gt; & Lt; / Html & gt; Use DOM Navigation to get the value from the adjacent input:

$ (document) .ready (function () {$ (". Submit") click (function () {var name = $ (this) .next (). Val (); alert (name); });});

In addition, the page should have the same & lt; Html & gt; Do not cast blocks in that loop.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -