jQuery Selectors: Applying indexed selector to table row

This entry is part 31 of 33 in the series jQuery Selectors


As in the earlier example, the index selector could be applied to selecting a particular row in a table.

<!DOCTYPE html>
<head lang='en'>
    <meta charset='UTF-8'>
    <title>HTML Table</title>
    <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'></script>
        $(function () {
            $('tr:eq(4)').css('background-color', 'lightgray');
<table border='1'>
        <td>Rod Stewart</td>
        <td>Maggie May</td>
        <td>New Order</td>
        <td>Smell Like Teen Spirit</td>
        <td>Rod Stewart</td>
        <td>Out Of Order</td>