jquery Chinese text box get focus

Source: Internet
Author: User

Today, a small problem is that the text box needs to be entered in order to submit, if you do not enter the prompt and make the text box to get focus!

Such a simple thing is not an object if you don't use jquery. focus () It's all right,

But when we used jquery so $ ("#nameInput") returned was not a DOM object but a jquery object,

In this case $ ("#nameInput"). focus () The meaning of this method has changed,

Instead of getting the text box to focus, trigger the text box to bind all the functions in the onfocus!

In fact, it's very easy to use jquery to convert a jquery object into a DOM object, which I believe developers have long thought about, but it's first.

$ ("#nameInput") [0].focus () simple plus one [0] is what we want!!

Link Address: http://www.cnblogs.com/sukiwqy/archive/2010/04/20/1716166.html

jquery Chinese text box get focus

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.