Home > front end >  Expert guidance: jquery can set a value for the text box? Why can't set value to change after?
Expert guidance: jquery can set a value for the text box? Why can't set value to change after?

Time:09-17




Search & lt;/title> <br/><path d="m4.8495 7.8226c0.82666 0 1.5262-0.29146 2.0985-0.87438 0.57232-0.58292 0.86378-1.2877 0.87438-2.1144 0.010599-0.82666-0.28086-1.5262-0.87438-2.0985-0.59352-0.57232-1.293-0.86378-2.0985-0.87438-0.8055-0.010599-1.5103 0.28086-2.1144 0.87438-0.60414 0.59352-0.8956 1.293-0.87438 2.0985 0.021197 0.8055 0.31266 1.5103 0.87438 2.1144 0.56172 0.60414 1.2665 0.8956 2.1144 0.87438zm4.4695 0.2115 3.681 3.6819-1.259 1.284-3.6817-3.7 0.0019784-0.69479-0.090043-0.098846c-0.87973 0.76087-1.92 1.1413-3.1207 1.1413-1.3553 0-2.5025-0.46363-3.4417-1.3909s-1.4088-2.0686-1.4088-3.4239c0-1.3553 0.4696-2.4966 1.4088-3.4239 0.9392-0.92727 2.0864-1.3969 3.4417-1.4088 1.3553-0.011889 2.4906 0.45771 3.406 1.4088 0.9154 0.95107 1.379 2.0924 1.3909 3.4239 0 1.2126-0.38043 2.2588-1.1413 3.1385l0.098834 0.090049z"> </path> <br/></svg> </button> </td> <br/><Td & gt; <br/><Div title="clear results" & gt; <br/>& nbsp; <br/></div> </td> <br/></tr> <br/></tbody> <br/></table> <br/></form> <br/><br/>-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- <br/>The inside of the above HTML: & lt; Input autocomplete="off" type="text" size="10"... <br/>Jquery can only set a value for the text box? Why can't set value to change after? <br/>I use $(" # GSC - I - id1 "). The attr (" value ", "GGG"); Inside a web page can see set in, but I'll change a value, yyy, the text frame's value is still GGG, why? <br/><br/>Another strange question, I have the text of the button, use jQuery to click operation, the following: <br/>$(' GSC - search - button GSC - search - button - v2 '). Click (); <br/>Not working? <br/>Why is that? <br/><p class="article - content rp"> CodePudding user response: </p>May be the first time you set the GSC - I - after id1, other code (such as a js framework or js plug-in) for # GSC - I - id1 elements for the replacement, <br/><br/>Through multiple class name when choosing elements, each in front of the class name to add ". "and there can be no Spaces between the space becomes the descendant combinator, <br/>$('. The GSC - search - button. GSC - search - button - v2 '). Click (); <br/><p class="article - content rp"> CodePudding user response: </p><fieldset> <legend> reference 1/f, the sky wave response: <legend> <blockquote> may be the first time you set the GSC - I - after id1, other code (such as a js framework or js plug-in) for # GSC - I - id1 elements for the replacement, <br/><br/>Through multiple class name when choosing elements, each in front of the class name to add ". "and there can be no Spaces between the space becomes the descendant combinator, <br/>$('. The GSC - search - button. GSC - search - button - v2 '). Click (); </blockquote> <fieldset> <br/>No, time setting, including the second, after debugging real-time via a browser can I see the value value has changed, just change text box does not appear, very strange,,<p class="article - content rp"> CodePudding user response: </p><pre> <br/><script SRC="https://cdn.bootcss.com/jquery/3.4.1/jquery.js" & gt; </script> <br/><Input id="a" type="text" & gt; <br/><script> <br/>$(' # a '). Attr (' value ', 'GGG) <br/>SetTimeout ()=& gt; {<br/>$(' # a '). Attr (' value ', 'yyy) <br/>}, 2000) <br/></script> <br/></pre> <br/><br/>Click the selector to write wrong, don't have the dom, <br/><pre> <br/>$('. The GSC - search - button. GSC - search - button - v2 '). Click (); <br/></pre><p class="article - content rp"> CodePudding user response: </p>Use on (" click ", the function)<p class="article - content rp"> CodePudding user response: </p>Try with val (" yyy ") setting<p class="article - content rp"> CodePudding user response: </p>$. Attr (" value ", value) modification is to mark, is the initial value <br/>$. Val (value) modify the domain, the user can interact to change </div> <div class="th_page th_page_color"></div> <div class="umCopyright"> <p>Page link:<a href="/frontend/6527.html" target="_blank" style="color:#999">https//www.codepudding.com/frontend/6527.html</a></p> </div> <div class="detail-arr"> <div class="detail-arr-left">Prev:<a href='/frontend/6526.html'>Redis local installation</a></div> <div class="detail-arr-right">Next:<a href='/frontend/6528.html'>Pray god to help me see what's going on</a></div> </div> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="hot-tags neitags"> <ul> <li><i class="iconfont icon-x-tags"></i> Tags:  </li> <a href='/e/tags/?tagname=JavaScript' target='_blank'>JavaScript</a> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="xiangguan"> <ul class="msg msghead"> <li class="tbname">Related</li> </ul> <ul> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="flinks"> <ul> <li><i class="iconfont icon-x-tags"></i> Links:  </li> <li class="liflinks"><a target="_blank" href="/" title="CodePudding">CodePudding</a></li> </ul> </div> </div> </div> </div> <div class="footer"> <p><span style="font-size:16px;color:#666;font-weight: bold">About Us:</span>  <a href="https://www.codepudding.com/contact.html">Contact Us</a>      <a href="https://www.codepudding.com/service.html">Terms of Service</a>      <a href="https://www.codepudding.com/privacy.html"> Privacy Policy</a></p> <p class="foot_info">Copyright © 2010-2023,Powered By <a href="/" target="_blank">CodePudding</a> </p> </div> <script type="text/javascript" src="/skin/code/tianhu.js"></script> </body></html>