Chila jquery Selector < 21 >

Source: Internet
Author: User

First, attribute filter

$ (' input[name] ') Select the element with the name attribute on all input labels on the page

$ (' input[name=xxx] ') selects all input tags on the page with the name attribute and the value equals XXX element

$ (' input[name! =XXX] ') selects all input tags on the page with the name attribute and the value is not equal to the element xxx

$ (' input[name^=x] ') Select all input tags on the page have the name attribute and the value is an element that begins with X

$ (' input[name$=x] ') Select all input tags on the page have the name attribute and the value is an element that ends with X

$ (' input[name*=x] ') Select all the input tags on the page have the name attribute and the value contains the element of X

$ (' input[name][value]: ') Selects all the input labels on the page that have the name attribute, the element of the Value property

$ (' Fome:d isabled ') Select all the disabled elements under the Form tab, notice that there is a space behind the Fome

$ (' fome:enabled ') Select all elements that are not disabled under the Form tab, note that there is a space behind the Fome

$ (': CHECKD ') Select all elements on the page that are checked true and do not include selected:checked to select all selected radio and checkboxes

$ (': Selected ') Select all elements on the page that are selected true: Selected represents all selected select elements

Second, form selector

$ (': input ') Check all labels in the form, including input TEXTAREA radio checkbox Select button

Equivalent to $ (' Input,radio,checkbox ... ')

$ (': Text ') indicates that all single-line text boxes are selected. Equivalent to $ (' input[type=text] ')

$ (': CheckBox ')

$ (': Radio ')

The same as ': Tag type ' is the element that selects the corresponding form in the page

$ (' a '). attr (' href ', ' http://www.baidu.com '); means to get a label on the page and assign a value to its href attribute

$ (' a '). removeattr (' href ') removing the href attribute

Iii. jquery Dynamic creation of an object

var alink=$ (' <a href= ' ... ' title= ' dfdfdbsdk ' > Baidu </a> '); Create an Object

Alink.attr (' Tagert ', ' _blank ') Add attributes to this object

$ (' div '). Append (ALink); Add to a layer

$ (' <input/> '). AppendTo (' #div ') means creating an element and appending the element to the layer with the ID #div.

Iv. Emptys and remove

A.emptys () means emptying all child elements under an element without their own

A.remove () means that deleting the current element contains all the child elements under the element Remova has a return value,

The return value is the removed element that contains the removed child element

It is not necessary to delete the element when it is moved on the page, move it directly (Append, AppendTo),

Because an element in the DOM can have only one parent node

Chila jquery Selector < 21 >

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.