Today is the fourth lesson. Main Learning Filter Selector $ (function () {/* filter selector abbreviation: filter. It is also a selector, and this selector is similar to the pseudo-class in css3* (t.mb5u.com/css3/), which can be supported by low-version browsers that do not support CSS3. Like the regular * selector, JQuery
Visibility FilterThe visibility filter selects the appropriate element based on the visibility and visibility of the element.
Filter Name
JQuery syntax
Description
Return
: Hidden
$ (': Hidden ')
Select all Invisible elements
Collection elements
: Visible
$ (': visible ')
Select all visible eleme
JQuery filter selector detailsSelect the first element (: first) as the basic filter selector)
// Select the first div element. $ ('# btn1'). click (function () {$ ('div: first'background .css (background, # bfa );})Select the last element (: last)
// Select the last div element. $ ('# btn2'). click (function () {$ ('div: last'background .css (background, # bfa )
child element under each parent element: Last-chlid selects the last child element under each parent element: Only-chlid If an element is the only child element of the parent element, matches if it contains other child elements.$ (function () { $ (' Div.one:nth-child (2) '). CSS (' background ', ' red '); Class is the second child element of the div of one (' Div.one:last-child '). CSS (' background ', ' blue '); Class is the last child element of the div of one
. DEBUG.log (employees); }); });Script>$ ("tr:gt (0)") selects all the HTML elements with the tag name ' tr ' except for the first record and returns theJQuery object.. Map () iterates through each element from the set of selected elements and processes them in the function.return $ (this). Children (). First (). Text () returns the text content of the first child Element (TD) of eachSelected "TR" element, which is the employee name.A new JQuery
Using jquery to filter table content
When there is a large amount of data in the table, we cannot search one page at a time. In this case, we can use a search box to search.
For this search box, we can use the keyup event for better user experience to start filtering when the user inputs, rather than clicking the search button after entering the information.:
Implementation Code:
The above is all the cont
This example describes the JQuery form field property filter usage. Share to everyone for your reference. The specific analysis is as follows:
Forms contain a variety of form fields, and using the form field Property selector makes it easy to get the radio buttons that have been selected, check boxes, list items, or Find form fields from the document based on whether or not they are available.
1.: Checked
The examples in this article describe the basic filter selector usage in jquery. Share to everyone for your reference. as follows:
I hope this article will help you with your jquery programming.
values, counting from 0. For example: $ ("Tr:even"):first matches the first element found. For example: $ ("Tr:first"):GT (index) matches all elements that are greater than the given index value, counting starting at 0. For example: $ ("tr:gt (0)"):last matches the last element found. For example: $ ("Tr:last"):lt (index) matches all elements that are less than the given index value. For example: $ ("Tr:lt (2)"):not (selector) removes all elements that match the given selector. For example: $ (
1. Version issuesIf you can get the following elementsAnd you're using a jquery that's higher than the 1.3 version, and you can't get the elements hidden through the Visibility:hidden style.2. Solution$ ("div"). Filter (function (){if ($ (this). CSS ("visibility") = = "Hidden" | | $ (this). CSS ("display") = = "None"){return true;}});Get all the hidden divjquery Visibility
Contains a text selector:Used to filter elements based on the text content of a label, returning an element collection.1 Scripttype= "Text/javascript">2 $(function(){3 $("div:contains (test)"). CSS ("background","#bbffaa");4 });5 Script>Contains the element selector:: Has (), which is used to filter elements based on the child elements of a tag, returning an element collection.1 Scripttype=
The filter rule for a property filter selector is to get the corresponding element through the attributes of the element 1.[attribute] Usage : $ ("div[id]"); return value collection element Description: Matches the element that contains the given property. In the example, all div tags with the id attribute are selected. 2.[Attribute=value] Usage : $ ("input[name= ' newsletter ')"). attr ("Checked", true);
There is a grep () method in jquery for array element filter filtering, which is, sadly, not normally found in the API documentation we use. View official Description: http://api.jquery.com/jQuery.grep/
how grep () is used:
grep (Array,callback,invert)
Array: to be filtered arrays;
Callback: Handles each element in the array and filters the element, which contains two parameters, the first is the value
The has (selector selector or DOM element) retrieves the set of matching elements, based on the selector or DOM element, to retrieve whether the condition exists in the descendants of each element, and makes the qualifying element a new result set.
Here's an example:
Copy Code code as follows:
Copy Code code as follows:
$ (' Li '). has (' span '). CSS (' background-color ', ' red ');
the results obtained are as follows:
This example shows that w
Has not been very clear the difference between the filter () method and the Find () method, today in the Reading of jquery Cookbook book, finally be made clear.
Filter () filters the DOM element wrapper set, which refers to manipulating the current element set, deleting mismatched elements, and getting a new set
Copy Code code as follows:
$ (' div ').
A filter shutter slide Effect Based on jQuery.
With the loading progress switch, and arrow direction effects, the progress bar automatically switches after reading, move the cursor to the center of the picture and stop switching.
There are multiple special effects and thumbnail scrolling during the switching process. A very good image viewing jquery special eff
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.