This article introduces several methods of the jquery traversal filtering array and the concrete implementation of parsing the JSON object, and interested friends don't miss the jquery grep () filter traversal array nbsp; nbsp; code as follows: $ (). Ready (nbsp; function () {nbsp; var array = [1,2,3,4,5,6,7,8,9];nbsp; var filt Erarray = $.grep (array,function
When writing the front page, often use the Find method in jquery to look for the elements we want, then jquery also need a method filter also has the function of filtering elements, then what is the difference between the two. An example is provided:
When the page is loaded, you can see the pop-up content, one is: I am find, one is: I am The Find method is a s
This method is used to check whether the current element contains a particular class on top of the selector, and returns True if there is one.Instance: [jquery filter Hasclass (Class)] This method is used on the basis of the selector to check whether the current element contains a particular class, and if so, returns true
element categories less than the given index value, counting from 0 $("li:lt (4)"). addclass ("GetFocus"); }) $(function(){ //add title class element category $("Div H1"). CSS ("width","238"); $(": Header"). addclass ("GetFocus"); }) $(function() {Animateit ();//Add animation effect element category $("#spnMove: Animated"). addclass ("GetFocus"); }) functionAnimateit () {//animation effects $("#spnMove"). Slide
Transferred from: http://blog.csdn.net/woshisap/article/details/7341136In an HTML document, the opening tag of an element usually contains multiple attributes (attribute), in jquery, in addition to the direct use of the ID and class attributes as selectors, it is also possible to select from a variety of attributes (such as title, etc.)The element that is queried is filtered, and the attribute filter select
This example describes the jquery child attribute filter selector usage. Share to everyone for your reference. The specific analysis is as follows:
1.: First-child Selector
All elements that are used to select the first child element of its parent, in the format:
Copy Code code as follows:
$ ("Selector:first-child")
Such as:
Copy Code code as follows:
$ ("Ul:first-child").
") //4. Select the second and third Li elements $ ("Li: GT (0): LT (2) "). CSS (" Background "," blue ") is not the same, from left to right, select a given value from the new benchmark to choose //5. Select Li $ (" Li:contains (') with BBBBB content BBBBB '). CSS ("Background", "blue") //6. Select the hidden li console.log ($ ("Li:hidden"). length,$ ("Li:hidden") [0]) //7. Select the Li element with the title attribute $ ("Li[title]"). CSS ("Background", "blue") /
Pseudo child element filter selector
This article mainly introduces the contents of the Nth-of-type () selector. This section does not appear in the "Sharp jquery" book, Nth-of-type () selector reference CSS in the Nth-of-type selector, in the 1.9 version of the new common form
: Nth-of-type ()
Personally,: the Nth-of-type () selector should not be categorized as a child element selector, nor exactly the i
Recently learning jquery, found that its selector of the wording of the CSS and the basic syntax is very similar, plus the space difference is very large.$ (": first-child)--:first simply returns a single element, and the First-child selector matches the first child element for each parent element.
such as child element filter selectors
Li:first-child (without spaces), where the parent element refers to the
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.