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>