w3resource

jQuery: Find the sixth cell of a 3x3 table

jQuery Fundamental - II : Exercise-87

Find the sixth cell (second row and third column ) of a 3x3 table.

Sample solution :

HTML Code :

<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-git.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Find the sixth cell  (second row and third column ) of a 3x3  table</title>
</head>
<body>
<table border="1">
<tr><td>Cell-1</td><td>Cell-2</td><td>Cell-3</td></tr>
<tr><td>Cell-4</td><td>Cell-5</td><td>Cell-6</td></tr>
<tr><td>Cell-7</td><td>Cell-8</td><td>Cell-9</td></tr>
</table>
</body>
</html>

JavaScript Code :

$( "td:eq(5)" ).css( "color", "red" );

See the Pen jquery-fundamental-exercise-87 by w3resource (@w3resource) on CodePen.


Contribute your code and comments through Disqus.

Previous: Set the background color of the 4th division red by adding an appropriate class.
Next: Finds even table rows, matching the first, third and so on (index 0, 2, 4 etc.)

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/jquery-exercises/2/jquery-fundamental-exercise-87.php