This example describes the jquery content filter selector usage. Share to everyone for your reference. The specific analysis is as follows:
In an HTML document, the content of an element can be text or a child element, and if you use a selector or a content filter selector, you can further filter out the element in th
Find () looks for elements within the DIV element that have class classname.
Filter () is the element that filters the div's class as classname.
Basically find the child element, filter is peer to find
The find function is queried in the child elements of the current object collection;
The filter function is to filter
This article mainly introduces the subelement filter selector in jQuery, and lists some methods to obtain the parent element when operating the DOM, you can refer to the filter rules of the child element filter to obtain the corresponding elements through the relationship between the parent element and the child elemen
filter () and not ():
Copy Code code as follows:
A new challenge is to select only one particular element from a group of similar or identical elements.
jquery provides filter () and not () to do this.
Filter () is able to streamline the elements to only those that satisfy the
$ (myform.elements).jquery Select Filter Learning:$ ("Tr:even")----match all even rows (indexed value query)$ ("tr:odd")----match all the technical lines$ ("Tr:eq (2)")----match the content of the TR element labeled 2$ ("TR:GT (1)")----match all rows with subscript greater than 1$ ("Tr:lt (2)")----match all rows with subscript less than 2$ ("Div:not (: Animated)"). Animate ({left: "+=20"},1000);----only per
Filter () and not ():
CopyCode The Code is as follows:
A new challenge is to select only one specific element from a group of similar or identical elements.
Jquery provides filter () and not () for this.
Filter () can streamline the elements to only those that meet the filter
)"). CSS ("Background", "red")//})//lt Third, sub-element filter$ (function () { $ ("Li:first-child"). CSS ("Color", "green") // Gets the parent tag of each Li, and then the first Li tag in each parent element is selected by the $ (" Li:last-child "). CSS (" Color "," green ") // Gets the parent tag of each Li, and then the last Li tag in each parent element is selected $ (" Li:onl
Usage of the basic filter selector in JQuery
This document describes how to use the basic filter selector in JQuery. Share it with you for your reference. The details are as follows:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
Children ([expr])
Obtains the element set of all child elements of each element in a matched element set.
You can use an optional expression to filter matched child elements. Note: parents () searches for all ancestor elements, while children () considers child elements instead of all descendant elements.
Returned value: jQuery
Parameters:
Expr (String): (optional) expression used to
The code I wrote today was read to the project manager because it didn't take into account the problem of SQL injection, and then when he tested my code, he hit a "'" and my program hung up!
So I found a jquery! on the internet that validates and filters the text box.
First figure:
PS: Here with @ #测试, because ' too small, can not see clearly!
Specific jquery code:
This is in the form of a b
Children ([expr])
Gets a collection of elements that contain all the child elements of each element in a matching set of elements.
You can filter the matched child elements through an optional expression. Note: parents () will look for all ancestral elements, while children () takes child elements into account regardless of all descendant elements.
return value: JQuery
Parameters:
Expr (String): (optional)
The following usage is recorded:
Jquery grep () filters and traverses Arrays
$ (). Ready ( Function (){ VaR Array = [1, 2, 3, 4, 5, 6, 7, 8, 9 ]; VaR Filterarray = $. grep (array, Function (Value ){ Return Value> 5; // Filter out more than 5 }); For (VaR I = 0; I ) {Alert (filterarray [I]);} For (Key In Filterarray) {alert (filterarray [Key]) ;}});
JqueryEach()
The example in this article describes the use of the filter () function and the Find () function in jquery. Share to everyone for your reference. The specific analysis is as follows:
$ ("Div. cont");
Equivalent to $ ("div"). Find (". Cont")
The filter () function is the function of each object in the collection (what is here, what is obtained).
The Find () fu
Dark Horse day16 jquery attribute filter selector, day16jquery
The filter rule of the attribute filter selector obtains the corresponding element through the attribute of the element.1. [attribute]
Usage: $ ("div [id]"); return value set Element
Description: matches the element containing the given attribute. In this
Jquery filters table data using the select list selection box
Table DataCopy codeThe Code is as follows:
JS filter code, where select is dynamically generatedCopy codeThe Code is as follows:$ ("# Example> thead th"). each (function (I ){$ ("$ ("# Example> tbody> tr"). show (). filter (function (){Var comb = [], children = $ (this). children ();Children. each (fun
: Here is ":p arent", not ". Parent" Oh! The feeling and the above said ": Empty" form an antonym.The Visibility filter selector selects the appropriate element based on the visible and invisible state of the element1,: Hiddenusage: $ ("Tr:hidden")return value Collection elementDescription: Matches all invisible elements, and the INPUT element's type attribute is "hidden", which is also matched to. css display:none and Inputtype= "Hidden " will be m
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.