Summarize:child element selectors in pseudo-classes:The first type:: First-child: Last-child: Nth-child (): Nth-last-child ()The second type:: Only-child: Only-of-typeThe third type of:: First-of-type: Nth-last-of-type (): Nth-of-type ()Characteristics:Pseudo-class selectors are very characteristic:1. Position: Directly through the pseudo-class selector directly to get the beginning of the end and the first few, usually and the target
For example, when processing an event, you sometimes need to know the number of subnodes currently clicked, And the html dom itself does not directly provide the corresponding attributes, which must be calculated by yourself.From an index serial number, it is easy to obtain the corresponding sub-node or sub-element of the index, directly use parentNode. childNodes [index] Or parentNode. children [index.However, if a node or
1. Add an element inside or outside the element
Append, prepend: add to child element
Before, after: Add as a sibling Element
Html:
Copy codeThe Code is as follows: Javascript:Copy codeThe Code is as follows:
Add an element to # content. This is to retire Copy codeThe Code
One, select the child element of the element parent (contains other different elements)(1) li:first-child {}; Select the first child element (note that there is no parentheses here)(2) Li:last-child {}; Select the last child element in UL(3) Li:nth-child (3) {}; The third element
In the premise does not know B in this array subscript, delete b this elementvar arrlist = [' A ', ' B ', ' C ', ' d ']; Arrlist.splice (Jquery.inarray (' B ', arrlist), 1);alert (arrlist);where Jquery.inarray (' B ', arrlist) is the position of this element in the array arrlist the first parameter in the splice (index,1) function is the position of the element to be deleted in the array, and the second par
JavaScript determines that an element is a sub-element of another element uses a lot of, the most common is when you click on the blank space to perform certain operations, such as pop-up layer.function Isparent (obj,parentobj) {while (obj! = undefined obj! = null obj.tagName.toUpperCase ()! = ' BODY ') {if (obj = = parentobj) {return true;} obj = Obj.parentnod
the head node, so L is a head pointer, the head pointer is the necessary element of the list//if (L = = NULL)//return ERROR;//l->next = NULL;//makes the pointer field of the head node empty.//return OK;//}//destroy the linked list L, release the linked list L The requested memory, so that the value of L becomes null again, so it will change the value of L, with *lStatus List_link_destory (linklist *L) {linklist p,q; P= (*l)Next; while(p) {Q= p->N
First, we need to understand that all HTML elements are either block or inline ). The following describes the features of block and inline:
Features of block elements:Always starts on a new line;Height, row height, and top and bottom margins can be controlled;The default width is 100% of its container unless a width is set.
Features of the inline element:And other elements are on one line;High, the Row Height and top and bottom margins cannot be changed;The width of a text or image cannot be
JQuery determines whether an element exists, and jquery determines the element
JQuery's principle of determining whether an element exists is slightly different from that of javascript, because $ the element selected by the selector does not return null or undefined no matter whether it exists. JQuery is used to deter
PHP Array add element method summary, PHP array elements Summary
This article summarizes the method of adding elements to the PHP array in detail. Share to everyone for your reference. The specific analysis is as follows:
If we are a one-dimensional array to add array elements we can use Arraylistay_push, of course, in addition to this method we have a more direct approach, here to arrange for you.
Adding elements to a one-dimensional arrayCopy the C
We know that elements are floating or relatively positioned, leaving the element out of the flow of the document. If the parent element does not set a fixed height, the height of the floating child element is not calculated when the height is calculated. However, sometimes we need the parent element to calculate the he
169. Majority ElementGiven an array of size n, find the majority element. The majority element is the element, the appears more than times ⌊ n/2 ⌋ .Assume that the array was non-empty and the majority element always exist in the array. Hide TagsArray Divide and conquer Bit manipulationHide Similar Problems(M) Majority
Transferred from: http://www.w3school.com.cn/css/css_boxmodel.aspTo know the transformation of the box model in the case of the parent element: float, rel, ABS position, see: http://www.cnblogs.com/hh54188/archive/2010/12/28/1919078.html, in addition, For how to calculate the width and height of the parent element, The article also explains the ~CSS Box Model OverviewThe inner part of the
Currently several borrowing jquery Select click Element to get the current click Element Information,$ (document). Click (function (e) {//) to trigger this event at any point in the page ( e.target). attr ("id"); E.target = clicked Target})This method is needed to obtain the current Click Element information such as id,value, such as information, can not b
JQuery's property operation is very simple, and here is a A-element to describe the property's get/set/delete operation
Copy Code code as follows:
Add properties
$ (' a '). attr (' href ', ' http://www.jquery.com ')
Add multiple properties
$ (' a '). attr ({' href ': ' http://www.jquery.com ', ' title ': ' Jquery.com '})
Get Properties
$ (' a '). attr (' href ')
Class attribute
AddClass ()
Add a Class
Hasclass ()
Dete
For an array of primitive type elements , you can use the indexof () artifact directly, return the subscript of the element in the array, and return 1 if not found:
var arr = [1,2,3,4,5];
var index = Arr.indexof (3); 2
For arrays with objects as elements , there is no direct function to use, but there is a filter () method that creates a new array in which the elements in the new array are checked for all elements that match the criteria in the spe
This article mainly introduces the sample code for jquery to determine whether the child element of an element exists. If you need it, you can refer to it and hope to help jquery determine whether the child element exists.
1. Determine whether a child element exists // If ($ ("# specialId> img"). length = 0)If ($ ("
First, the tag node is obtained by the ID attribute value of the tag. Accepts a parameter: Returns the Htmldivelement object of the element if the corresponding element is found, or null if it does not exist. The result is: Htmldivelement (the Node object representing the Div)The ID represents the uniqueness of an element node and cannot create the same named ID
prev () Definition and usage
The prev () function moves a pointer to the current element to the position of the previous element and returns the element value.
The function returns False if the inner pointer has already exceeded the first element of the array.
Grammar
Prev (array) parameter description
Array require
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 conditions are based on Dom, none of the Results act on a complete element, such as the entire
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.