jquery text box loses focus gets the value of the current text box and the value of the hidden field

Source: Internet
Author: User

My JS level is a bit bad, get a text box lose focus and get the value of the corresponding hidden field for 3 minutes, hi. For those JS, jquery, the great God to express their high esteem. In this the implementation of the code posted to do not know the Codefans to look at, applicable to the cycle list, dynamic change in order, the great God floated over it.


HTML code

<script src= "http://code.jquery.com/jquery-latest.js" ></script>
<ul id= "px1"
     <li>
        <input type= "text" value= "  size=" 5 "name=" Zs "/>"
        <input type= "hidden" value= "5" name= "Hidd"/>
    </li>
    <li>
         <input type= "text" value= "a"   size= "5" name= "Zs"/>
        <input type= "hidden" value= "6" name= "Hidd"/>
    </li>
    <li
        <input type= "text" value= ""   size= "5" name= "Zs"/>
        <input type= "hidden" value= "7" name= "Hidd"/>
     </LI>
    <li>
        <input type= "text" value= "  size=" "5" name= "Zs"/>
         <input type= "hidden" value= "8" name= "Hidd"/>
    </li>

</ul>


jquery Code


<script>
$ ("document"). Ready (function () {
$ (' #px1 Li '). Find ("Input[name=zs]"). blur (function () {
var ZS = $ (this). Val ();
var uid = $ (this). Next ("Input[name=hidd]"). Val ();
alert (ZS);
Alert (UID);
});
});
</script>


Effect chart

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.