jquery Click on a line to change the background color, other rows to revert to the original color __jquery

Source: Internet
Author: User

http://blog.csdn.net/y_h_t/article/details/6260426


<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>

<title> Untitled Document </title>

<script type= "Text/javascript" src= "Jquery-1.3.2.min.js" ></script>

<script type= "Text/javascript" >

$ (document). Ready (function () {

$ ("#each li"). Click (

function () {

$ (this). CSS ("Background", "#FF0000"). Siblings (). CSS ("Background", "#ffffff");

});

});

</script>

<style type= "Text/css" >

</style>

<body>

<div id= "Each" >

<ul>

<li>111111111111111111111111</li>

<li>222222222222222222222222</li>

<li>333333333333333333333333</li>

<li>444444444444444444444444</li>

<li>555555555555555555555555</li>

<li>666666666666666666666666</li>

<li>777777777777777777777777</li>

</ul>

</div>

</body>

What does the siblings () in jquery mean?

The siblings () method is to obtain the sibling node of the node object that invokes the method;
Sibling objects
such as:
<div id= "AAA" >
<p>1</p>
<p>2</p>



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.