Skip to main content

Bug Tracker

Side navigation

Ticket #5414: Jquery-bug.html
File Jquery-bug.html, 2.7 KB (added by CarSandwich, October 28, 2009 08:43AM UTC)

Example showing bug

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Test</title>
</head>
<body>
    <form id="form1">
    <fieldset>
        <legend>Cheese Table</legend>
        <table id="CheeseTable">
            <thead>
                <tr>
                    <th>
                        Name
                    </th>
                    <th>
                        Rating
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        Chedder
                    </td>
                    <td>
                        5
                    </td>
                </tr>
                <tr>
                    <td>
                        Swiss
                    </td>
                    <td>
                        3
                    </td>
                </tr>
                <tr>
                    <td>
                        English
                    </td>
                    <td>
                        2
                    </td>
                </tr>
            </tbody>
        </table>
    </fieldset>
    <br />
    <fieldset>
        <legend>Beer Table</legend>
        <table id="BeerTable">
            <thead>
                <tr>
                    <th>
                        Name
                    </th>
                    <th>
                        Rating
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        VB
                    </td>
                    <td>
                        3
                    </td>
                </tr>
                <tr>
                    <td>
                        Corona
                    </td>
                    <td>
                        5
                    </td>
                </tr>
                <tr>
                    <td>
                        EB
                    </td>
                    <td>
                        1
                    </td>
                </tr>
            </tbody>
        </table>
    </fieldset>
    </form>

    <script src="jquery-1.3.2.min.js" type="text/javascript"></script>
    <script>
        $(document).ready(BindTable);

        function BindTable() {
            //$('#BeerTable tbody tr:not(:first)');

            var rows = $('#BeerTable tbody tr:not(:first)');
            
            rows.css("background-color", "red");
            rows.live("dblclick", RowEvent);
        }

        function RowEvent(event) {
            alert('Clicked!');
        }
    </script>
</body>
</html>

Download in other formats:

Original Format