Jquery (3-10) traversal, brother, child, closest (), node

Source: Internet
Author: User

 

<! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en">
<HTML>
<Head>
<Title> epoch. html </title>
 
<Meta http-equiv = "keywords" content = "keyword1, keyword2, keyword3">
<Meta http-equiv = "Description" content = "this is my page">
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">

<! -- <LINK rel = "stylesheet" type = "text/CSS" href = "./styles.css"> -->

<SCRIPT type = "text/JavaScript" src = "../jquery-1.7.1.js"> </SCRIPT>

</Head>
<Style type = "text/CSS">
. WID {
Width: 150px;
Color: Purple;
Font-weight: bold; <! -- Bold -->
}
. Hei {
Height: 150px;
}
. Another {
Font-style: italic; <! -- Italic -->

}
</Style>
<Body>

<H3> S <br> <Strong title = "Mouse"> A mouse falls into a rice tank </strong>
<Strong title = "cat"> There is a cat in the rice tank.

<P class = "wid" Title = "select the fruit you like"> what kind of fruit do you like? </P>
<Ul style = "background-color: Purple">
<Li Title = "apple"> Apple </LI>
<Li Title = "orange"> orange </LI>
<Li Title = "pineapple"> pineapple </LI>
<Li Title = "banana"> bananas </LI>
<Li Title = "Li Zi"> Li Zi </LI>
</Ul>

<Input type = "text" id = "username" value = "Enter the user name"/>
<Input type = "text" id = "password" value = "Enter Password"/>
<Input type = "button" id = "button" value = "login"/>


<Select id = "one" multiple = "multiple">
<Option value = "1" selected = "selected"> Haha </option>
<Option value = "2"> Haha </option>
<Option value = "3"> </option>
<Option value = "4"> ga </option>
</SELECT>

</Body>
<SCRIPT type = "text/JavaScript">
// Children () obtains all child elements of the matching element. This method only considers child elements, not child elements.
/*

$ (Function (){
VaR $ children = $ ('body'). Children ();
VaR $ ul = $ ('ul '). Children ();
Alert ($ children. Length); // print out 11 child elements
Alert ($ ul. Length); // print 5 child elements

For (VAR I = 0; I <$ ul. length; I ++ ){
Alert ($ ul [I]. innerhtml); // output to HTML

}*/

// Next () This method is used to obtain an element closely adjacent to the matching element.
$ (Function (){
VaR $1 = $ ('P'). Next ();
For (VAR I = 0; I <$1. length; I ++ ){
Alert ($1 [I]. innerhtml); // output to HTML

}
})

})
</SCRIPT>


</Html>

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.