Introduction to using wildcard characters in the selector of jquery

Source: Internet
Author: User
Tags code tag

  This article mainly introduces the wildcard characters in the jquery selector, and the friends you need can refer to the following

1. Selector   (1) wildcard:  code as follows: $ ("input[id^= ' Code ']"); all input tags   $ ("input[id$= ' Code ')" starting with Code;// id attribute all input tags with code end   $ ("input[id*= ' Code '");//id property contains all input tags for code     (2) According to the index selection   code as follows: $ (" Tbody Tr:even "); Selects all TR tags   $ ("tbody tr:odd") indexed to even numbers; Select all TR tags     (3) with an odd index to obtain the number of input for the next level node in Jqueryobj     code as follows: Jqueryobj.children ("input"). Length;     (4) Get all <a> tags     code as follows: $ (". Main > a");    (5) Select next to label   & The code is as follows: Jqueryobj.next ("div");//Get jqueryobj tag immediately after a Div,nextall get all     2. Filter     Code is as follows://not   $ ("#code input:not ([id^= ' Code '])"//id for all input tags in the code tag that do not contain ID to start with code     3. The event   code is as follows:// Working with keyboard operations on text boxes   Jqueryobj.keyup (function (event) {  var keycode = event.which;//Gets the key value of the keyboard currently pressed, enter as 13 }     4. Tool function     code as follows: $ (' #someField '). Val ($ (' #someField '). Val ());//Eliminate spaces, Syntax: $.trim (value)    

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.