Bug Tracker

Opened 9 years ago

Closed 9 years ago

#7916 closed bug (invalid)

jquert 1.4.4 toggle(fn,fn) on <tr> mistake

Reported by: shuibiwoku@… Owned by:
Priority: undecided Milestone: 1.next
Component: unfiled Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by jitter)

I submitted the mistake is Jquery toggle (fn, fn) function in the table is on the tr fail calls, no hidden and show problem

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>
    <script src="../JQuery/jquery-1.4.4.min.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="txtUser" runat="server"></asp:TextBox>
        <table>
            <thead>
                <tr>
                    <th>姓名</th>
                    <th>性别</th>
                    <th>暂住地</th>
                </tr>
            </thead>
            <tbody>
                <tr class="parent" id="row_01">
                    <td colspan="3">前台设计组</td>
                </tr>
                <tr class="child_row_01">
                    <td>张三</td>
                    <td>男</td>
                    <td>浙江宁波</td>
                </tr>
                <tr class="child_row_01">
                    <td>李四</td>
                    <td>女</td>
                    <td>浙江杭州</td>
                </tr>
                <tr class="parent" id="row_02">
                    <td colspan="3">前台开发组</td>
                </tr>
                <tr class="child_row_02">
                    <td>王五</td>
                    <td>男</td>
                    <td>湖南长沙</td>
                </tr>
                <tr class="child_row_02">
                    <td>赵六</td>
                    <td>男</td>
                    <td>浙江温州</td>
                </tr>
                <tr class="parent" id="row_03">
                    <td colspan="3">后台开发组</td>
                </tr>
                <tr class="child_row_03">
                    <td>Rain</td>
                    <td>男</td>
                    <td>浙江杭州</td>
                </tr>
                <tr class="child_row_03">
                    <td>MaxMan</td>
                    <td>女</td>
                    <td>浙江杭州</td>
                </tr>
            </tbody>
        </table>
    </div>
    </form>
</body>
</html>
$(function() {
    $("tr.parent").click(function() {
        var trs = $(this).siblings(".child_" + this.id);
        trs.toggle(function() {
            trs.hide("normal");
        }, function() {
            trs.show("normal");
        });
    });       
});

Change History (2)

comment:1 Changed 9 years ago by addyosmani

#7909 is a duplicate of this ticket.

comment:2 Changed 9 years ago by jitter

Description: modified (diff)
Resolution: invalid
Status: newclosed

Thanks for taking the time to contribute to the jQuery project by writing a bug report. After a cursory look at your report I don't think there is any bug with jQuery. The javascript doesn't look right and won't do what you probably intended to do (e.g. you are using the wrong toggle() compare http://api.jquery.com/toggle/ vs http://api.jquery.com/toggle-event/).

As the jQuery bug tracker is not for support requests. Please use the jQuery Forum for support requests on this one.

As a starter use the correct toggle() and consider reading up on delegate()

Last edited 9 years ago by jitter (previous) (diff)
Note: See TracTickets for help on using tickets.