javascript - Text field to Hidden field value - value not being set -
I am having a problem with passing the missing values. I have a search field that will allow onclick to convert my javascript function to Calls the hidden field value to be set at the bottom of the page.
& lt; Div class = "search" & gt; & Lt; Input type = "text" name = "user name" class = "mySearch" value = "" & gt; & Lt; Input type = "button" class = "myButton" value = "" onclick = "setSearch ();" & Gt; & Lt; / Div & gt; My JavaScript is set out of the i function setSearch () {if (i == 0) {$ ('Input: hidden [name = "search1"]'). Val ($ (". MySearch"). Val ()); } And if (I == 1) {$ ('Input: hidden [name = "search2"]'). Val ($ (". MySearch"). Val ()); } I ++; } and then I'm trying to set the field
& lt; Div class = "sendallHolder" & gt; & Lt; Form method = "post" action = "getTweets.php" & gt; & Lt; Input type = "hidden" name = "test" id = "to" ""> gt; input type = "hidden" name = "id" "id =" until "/> Input type = "hidden" name = "latTest" id = "latTest" /> & lt; input type = "hidden" ; Input type = "hidden" name = "search1" id = "search1" /> input type = "hidden" name = "search2" id = "search2" /> & gt; Lt; input type = "submit" class = "sendAll" value = "gather news!" & Gt; & lt; / form & gt; & lt; / div & gt; < P> y Runs twice through the loop, but every time it does not set the prices properly in my hidden areas, Chrome Dev points out in Chrome that 'value' is popping up but no value is being set I am not sure what I am doing. Any thoughts?
: hidden selector does not appear in your consideration. It matches the elements that css Hidden using this, it does not match the type = "hidden" inputs. Just use $ ("# search1") on the elements, because you have id .
Comments
Post a Comment