The basic design idea and main usage of jquery

Source: Internet
Author: User

Select a page element, and then do something about it

$ (document)//Select Entire Documents Object

$ (' #myId ')//select page element with ID myId

$ (' div.myclass ')//select div element with class MyClass

$ (' input[name=first] ')//Select the name attribute equals first INPUT element

$ (' A:first ')//Select First a element in Web page

$ (' tr:odd ')//select odd rows of the table

$ (' #myForm: Input ')//Select INPUT element from form

$ (' div:visible ')//select the visible div element

$ (' Div:gt (2) ')//Select all DIV elements except the first three

$ (' div:animated ')//Select a DIV element that is currently in the animated state

$ (' div '). has (' P '); Select the div element that contains the P element

$ (' div '). Not ('. MyClass '); Select a DIV element that is not equal to the MyClass class

$ (' div '). Filter ('. MyClass '); Select a DIV element with class equal to MyClass

$ (' div '). First (); Select a 1th div element

$ (' div '). EQ (5); Select a 6th div element

$ (' div '). Next (' P '); Select the first P element after a DIV element

$ (' div '). parent (); Select the parent element of the DIV element

$ (' div '). Closest (' form '); Select the form parent element closest to Div

$ (' div '). Children (); Select all child elements of Div

$ (' div '). siblings (); Select sibling elements of Div

$ (' div '). Find (' H3 '). EQ (2). html (' Hello ');

$ (' div ')//Find DIV element

. Find (' H3 ')//Select one of the H3 elements

. EQ (2)//Select a 3rd h3 element

. html (' Hello '); Change its contents to Hello

$ (' H1 '). html (); HTML () has no parameters, which means that the value of H1 is removed

$ (' H1 '). html (' Hello '); HTML () has parameter Hello, which means to assign a value to the H1

. HTML () to remove or set HTML content

. Text () to remove or set text content

. attr () to remove or set the value of a property

. width () to remove or set the width of an element

. Height () to remove or set the height of an element

. Val () takes out the value of a FORM element

. InsertAfter () and. After (): Inserts an element from behind an existing element

. InsertBefore () and. Before (): Outside the existing element, insert the element from the front

. AppendTo () and. Append (): Inserts an element from behind within an existing element

. Prependto () and. Prepend (): Inside the existing element, insert the element from the front

The basic design idea and main usage of jquery

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.