Small problem with selector in jquery

Source: Internet
Author: User

  Write user registration verification encountered in the jquery selector problem, the following record, have encountered similar situation friends can refer to the following

Today, according to the jquery manual to learn about the use of selectors, ready to try to write a user registration verification, did not expect to start a very small problem to me stumped!     New people inevitably encounter very small details, this article only for pasted:    test part of the code as follows:  code: <script type= "Text/javascript" src= " Jquery.1.11.0.min.js "></script>  <script type=" text/javascript ">    function CheckUser () {//Check user name function   alert ("OK");//test ...  }    $ (document). Ready (function () {    $ (": Text:first"). blur (function () {//When lost focus triggers things    /** Here's where I've been doing this for so long. Of course I want to get the user registration elements, so I use     * As on the selector, the result is not! Check the code and find there is no error at all! What's the problem? Is there a problem with the use of the     * selector? I changed the #id selector, sure enough ok! but theoretically such a selector is certainly no problem!     * I also use $ (": Input:text"), Wrong! $ (": Input:eq (0)"); Error! Sister's! Where exactly is the problem?     * At the moment, hand a cheap, put: text and: First of a space accidentally deleted, a run, ni, ran up! Decisively again try just that     * Several selectors, full ok! After many tests, we get the following experience:    * Using a combination selector with internal relationships, there is no space between them! $ (": Text:first)" Error! $ (": Text:first)     **/correct!" When using a combination selector for hierarchical relationships, they should have spaces   checkUser ();   });    </script>    </head>& NBsP <body>    <form>  <fieldset>  <legend> registration page </legend>  User name < Input type= "text" > <br>  password <input type= "password" ><span> <br>  authentication password <input type= "Password" > <br>  email<input type= "text" ><span> <br>  <input type= " Submit "value=" registration >  </fieldset>  </form>    </body>  </html>  
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.