Jquery text box loses focus to get the value of the current text box and the value of the hidden field

Source: Internet
Author: User

Jquery text box loses focus to get the value of the current text box and the value of the hidden field

My js level is a little poor. It took 3 minutes to get the focus of a text box and the value of the corresponding hidden domain. Hi .. I would like to express my high respect to those js and jquery experts. Here, I will post the implementation code to the unknown codefans for a look. This applies to the loop list and dynamically changes the arrangement order.


Html code

<Script src = "http://code.jquery.com/jquery-latest.js"> </script>
<Ul id = "px1">
<Li>
<Input type = "text" value = "11" size = "5" name = "zs"/>
<Input type = "hidden" value = "5" name = "hidd"/>
</Li>
<Li>
<Input type = "text" value = "12" size = "5" name = "zs"/>
<Input type = "hidden" value = "6" name = "hidd"/>
</Li>
<Li>
<Input type = "text" value = "13" size = "5" name = "zs"/>
<Input type = "hidden" value = "7" name = "hidd"/>
</Li>
<Li>
<Input type = "text" value = "14" 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>


Related Article

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.