What is the correct syntax for this JQuery statement please? -
I post through Ajax and get a return value that I want to insert into an input text field - so on the "many" pages in the note so similar. Use parent
$ j (this). Parent ('form input [name $ = "tesitID"]'). Values (data)
The following jQuery form should cross a trigger inside the form The parents of, then get the input and set the value in the given data.
$ (this). Parent ('form') ('Input [name = "testID"]') .val (data);
Example:
& lt; Html & gt; & Lt; Top & gt; & Lt; Script type = "text / javascript" src = "jquery.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; $ (Function () (click (function () {$ (this) .Parent ('form'). ('Input [name =' testID "] '). Val (' data ') ;});}); & Lt; / script> gt; & gt; & gt; & lt; body & gt; & lt; form & gt; & lt; input type = "text" value = "" Name = 'testID' / & gt; & lt; input type = "button" value = "load AJAX" id = "trigger" /> & gt;
Comments
Post a Comment