Sharp jquery-Selector

Source: Internet
Author: User

1 jquery $ (document). Ready (function () {}) can be simply written as $ (function () {})  2 jquery objects and DOM cannot use each other's methods like ①jquery objects and Dom objects: Jqu The Ery object is converted to a DOM object ①jquery object is a collection of Dom objects, you can get the DOM object within the jquery object by subscript [index], ② can be provided by jquery, $ (' #obj '). Get (Index) Get DOM object ; Two: Dom objects are converted to jquery objects ① use $ (DOM object) to wrap Dom objects together;  3 jquery and other libraries (conflicts) The jquery library imports after other libraries ① can be handed over by Jquery.noconflict () method      $ control to other libraries (such as prototype.js), you can use jquery () as a manufacturing plant ② can also customize alternative names: var $j = jquery.noconflict () custom shortcut ③ If you want to use $, while other libraries also use $; A jquery.noconflict ()//Transfer $ symbol control in the outer layer;    jquery (function ($) {Continue with $ () method;}) b Jquer        Y.noconflict (); (function ($) {     pass the $ character as a parameter to the anonymous function}) (jquery); jquery can be used directly before other libraries, without using Jquery.noconfli CT () method;  4 Jquerydom operation ①jquery gets is always the object, if determine whether an element exists cannot use if ($ ("#tt")) {} and to determine the length of the obtained object if ($ ("#tt"). Lengt      h>0) {}5 jquery selector contains special symbols ① the selector with a special symbol must use the caret \ \ Eg: Gets the element with the ID of id#b ("#id \ #b") when the element with ID Id[1] is obtained $("#id \\[1\\]") 6 jquery selector with spaces ①var $t _a=$ ('. Test:hidden '); A descendant selector that represents the hidden element inside the element of the selection class as Test  ②var $t _b=$ ('. Test:hidden '); The filter selector indicates that the hidden class test element is selected, and that the PS (: Contains (") selector detects the contents of the filter element, as long as it contains the matched content is selected, as long as I have, as long as you want;; The selected element still conforms to the rule with a space 7:last:last-child①:last gets the last element in the matching collection ②:last-child if there is only one parent element for all elements in the matching collection, the same as: last, or a collection of child elements of several parent elements: Last-child selected as Child element is the last element collection of the parent element

Sharp jquery-Selector

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.