jQuery review (Day01)

jQuery is a JavaScript library, which encapsulates JavaScript to facilitate the operation of programmers

$是一个全局的对象,代表jQuery
入口函数:$(document).ready(function(){
    
    
        ....
    })
    简写方式:$(function(){
    
    
        .....
    })

Selector

Selector

Class selector: (". Class") id selector: (".class") id selector:( " . C L A S S " ) I D selected from the selection device : ( "#id")
tag selector:( "tag name") simultaneously acquiring a plurality of elements: ( "tag name") simultaneously obtain a plurality of elements:( " Standard sign name " ) same time won to take more than one yuan Su : (1label, 2 labels, label 3 ...)

Level selector:

(parent> child) − − − Get all the sibling elements immediately adjacent to all child elements under the parent element: (parent>child) --- Get all the sibling elements immediately adjacent to all child elements under the parent element: (parent>child)He is eligible to take the parent element element under the as has sub- element pixel immediately neighbor the same level element hormone : (PREV+ Next) - the next sibling of the current element immediately
sibling elements following:(PREV sublings) - - - Get Current The first element of the filter selector for all sibling elements after the element: (prev~sublings)---Get the first element of the filter selector for all sibling elements after the current element:(prev sublings)Eligible taken when the front element prime the rear of the have the same level membered element through the filter selected from the selection unit of a th element factors : (div:First) - Get a first selector element specifies the
last element:(div: Last ) − − − Get the index of the last element in the specified selector as an even number: (div:last)--- Get the index of the last element in the specified selector as an even number:(div:last)Eligible fetch refers to a given option selection is in the best after a th membered element index lead to an even number : (div:the even) - Get element specifies the selector even row
index is odd:(div: ODD) - - - Get specified Element index value of odd-numbered rows in the selector: (div:odd)---Get the element index value of odd-numbered rows in the specified selector:(div:odd)Eligible fetch refers to a given option selection is in an odd number of rows of element pixel index primers value : (:EQ (index)) - Gets the index value equal to the index of the element
is greater than the index:(: gt (index)) - - - Get index value The element greater than index is less than the index value: (:gt(index))---Get the element whose index value is greater than index is less than the index value:(:gt(index))Eligible take index primers value large to I n- D E X is meta element smaller in index primers value : (:lt (index)) - Gets the index value is less than the index of the element
gain focus: $ (: focus) - find the current acquired focus element

Content selector:

(: contains (text)) − − − Get elements whose content contains text text, for example: (:contains(text))--- Get elements whose content contains text text, for example: (:contains(text))Is eligible to take the content package contains have T E X T text present in the element element , cases such as : ( "Li: the contains ( 'JS')")
(: has (Selector)) - - - element acquires the content that contains the specified selector , For example (:has(selector))---Get the element whose content contains the specified selector, for example(:has(selector))He is eligible to take the content package comprising means specified option selection is the element element , cases such as ( "li: has ( 'aGet element li contains a label
$ (: parent) - Empty selection acquires the content is not is
$ (: empty) - Gets content is empty selector

Visibility selector:

(: hidden) − − − Get all hidden elements. For example: (:hidden)--- Get all hidden elements. For example: (:hidden)Eligible to take the have hidden hide yuan prime example such as : ( "the p-: hidden") to find all the hidden elements of P
$ (: visible) - Get all visible elements

Attribute selector:

$(div[attr])------Get the element with the specified attribute
$([attr!=value])------Get the element whose attribute value is not equal to value
$([attr=value]) ------Get the element whose attribute value is equal to value
$([attr^=value])------Get the element whose attribute value starts with value
([attr ([attr( [ a t t r =value])------Get the element whose attribute value ends with value
$([attr*=value])------Get the element whose attribute value contains value

Child element selector

$(:first-child)—Get the first child element
$(:last-child)—Get the last child element
$(:only-child)—Get the current element is the only child element

Form selector

$(:input)—Get all form elements, including select, textera
$(:text) —Get all text boxes
$(:password) —Get all password boxes
$(:radio) —Get all radio buttons
$(:enable)—Get all available form elements
$(:disable)—Get all unavailable form elements, the right one is radio, checkbox
$(:checked)—Get all selected form elements, the right one select

Guess you like

Origin blog.csdn.net/rraxx/article/details/115011516