JQUERY subnodes
Match the first child element: first matches only one element, and this selector matches one child element for each parent element.
$ (". Par: first-child"); // get the node whose id is firstli
The Code is as follows:
$ ('# Firstli h3.title'); // obtain h3 o
First, get the parent element
1. Parent ([expr]): Gets all the parent elements of the specified element
Second, get the sibling elements:
1, next ([expr]): Gets the next sibling element of the specified element
2. Nextall ([expr]): Gets all sibling elements behind the specified ele
Recently work has always encountered to take all kinds of Father son Ah brothers and sisters Ah, every time to check, this time to tidy up a internationals ~"How to Get JS"function dom () {var a = document.getelementbyidx_x_x ("Dom");var B = a.childnodes; Get all child nodes of avar c = A.parentnode; Gets the parent node of avar d = a.nextsbiling; Get the next sibling node of avar e = a.previoussbiling; Get the previous sibling node of avar f = a.firstchild; Get the first child node of avar g =
Commonly used element search methods in jQuery, jquery element search
$ ("# MyELement") Select the element whose id value is equal to myElement. The id value cannot be repeated. Only one id value in the document is myElement, so the result is a unique
jquery.parent (expr) to find a Father node, you can pass in expr for filtering, such as $ ("span"). Parent () or $ ("span"). Parent (". Class")jquery.parents (expr), similar to jquery.parents (expr), but finds all ancestor elements, not limited to parent elementsJquery.children (expr). Returns all child nodes, this method only returns a direct child node and does not return all descendant nodesjquery.contents (), returns all of the following, includin
The advent of jquery has provided a lot of convenience to the vast number of developers. From the need to own a knock code, to the direct call method, undoubtedly greatly improve the efficiency of website development. Some of the methods in jquery are very practical. The following is a description of the jquery selector: Gets the parent
One, gets the parent element 1, parent ([expr]): Gets all the parent elements of the specified element href_firhref_sechref_thrHREF_FIV$ (document). Ready (function () {$ ("a"). Parent (). addclass (' A_par ');}); Firebug View jquery Parent effect Two, get sibling elements: 1, next ([expr]): Gets the next sibling element
First, get the parent element
1. Parent ([expr]):
Gets all the parent elements of the specified element
Copy Code code as follows:
$ (document). Ready (function () {
$ ("a"). Parent (). addclass (' A_par ');
});
Firebug View jquery Parent Effect
Second, get the sibling elements:
1. Next ([expr]):
Gets the next sibling
follows:$ ("Li.third-item"). Parent (). CSS (' Background-color ', ' Aqua ');The effect is as follows:2, parents ()Gets the ancestor element of each element in the current matching element collection, which is optional by applying a selector.
$ (' li.item-a '). Parents (). CSS (' background-color ', ' red ');
The result of the c
specified element.Third, get child elements1. Find child element mode 1:>For example: var anods = $ ("ul > a"); Find all a labels under UL2. Find child element Mode 2:children ()3. Find child element Mode 3:find ()Here is a brief introduction to the similarities and differences between the following children () and find ():The 1> children and find methods are us
specified element.Third, get child elements1. Find child element mode 1:>For example: var anods = $ ("ul > a"); Find all a labels under UL2. Find child element Mode 2:children ()3. Find child element Mode 3:find ()Here is a brief introduction to the similarities and differences between the following children () and find ():The 1> children and find methods are us
jquery Determines if the current element is the first element gets the nth elementLet's say that you have the following HTML code:jquery determines that the current element is the first elementIf we click on any of the LI tags and want to know the number of Li tags that are currently clicked, you can use the following
Last month, the study of "JS to determine whether an element is another element of the child", it feels pretty good, but in the jquery application still have a lot of flaws, such as multiple elements of time is not very convenient to write. So write a simpler jquery to determine whether an
Finds all the parent elements of the current element until the matching element is encounteredIf the provided jquery represents a set of DOM elements, the. Parentsuntil () method also allows us to search through the ancestor elements of all elements until we encounter an element that matches the supplied parameter. The
Last month, I studied "js determining whether an element is a child element of another element". It seems quite useful, but there are still many defects in jQuery applications, for example, it is not convenient to write multiple elements. Therefore, I wrote a simple jQuery s
Jquery filtering element method, jquery filtering elementSummary of commonly used element search methods of jQuery1. Basics$ ("# MyELement ")Select the element whose id value is equal to myElement. The id value cannot be repeated. In this document, only one id value is myEle
Common pseudo-class and pseudo-element, pseudo-class Element
Pseudo class: Based on the status of the current element, for example, using hover: to hide a div.
Pseudo element: changes
Css pseudo-class, pseudo-element, and css pseudo-class Element
The pseudo class acts on the entire element, for example:
A: link {color: #111 ;}
A: hover {color: #222 ;}
Div: first-child {color: #333 ;}
Although none of these cond
JQuery uses (1) to mark element attributes and jquery to mark element attributes
JQuery mainly introduces how jQuery controls pages, including the attributes of elements, css style, DOM model, form elements, and event processing.
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.