Solved

find the number

Posted on 2012-03-27
2
236 Views
Last Modified: 2012-03-27
i am trying to find the every 3rd item and make the color green. pl advice.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {      
      
});
</script>
</head>
<body>
<ul>
<li>one</li>
<li>two</li>
<li>three</li>
<li>one</li>
<li>two</li>
<li>three</li>
<li>one</li>
<li>two</li>
<li>three</li>
<li>one</li>
<li>two</li>
<li>three</li>
<li>one</li>
<li>two</li>
</ul>
</body>
</html>

Open in new window

0
Comment
Question by:jcbmtt
2 Comments
 
LVL 20

Accepted Solution

by:
chaitu chaitu earned 400 total points
ID: 37770497
$(document).ready(function() {      
      $("ul li:nth-child(3n)").css("background-color", "red"); 
})

Open in new window

0
 
LVL 40

Assisted Solution

by:gurvinder372
gurvinder372 earned 100 total points
ID: 37770518
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question