Skip to main content

Bug Tracker

Side navigation

#7916 closed bug (invalid)

Opened January 07, 2011 02:51AM UTC

Closed January 07, 2011 02:29PM UTC

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

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

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");
        });
    });       
});
Attachments (0)
Change History (2)

Changed January 07, 2011 04:06AM UTC by addyosmani comment:1

#7909 is a duplicate of this ticket.

Changed January 07, 2011 02:29PM UTC by jitter comment:2

_comment0: 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 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 [http://forum.jquery.com jQuery Forum] for support requests on this one. \ \ As a starter use the correct `toggle()` and consider reading up on [http://api.jquery.com/delegate/ delegate()]1294410618661874
description: 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"); \ }); \ }); \ }); \ {{{ \ \ }}} \ \ \ \ 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"); \ }); \ }); \ }); \ }}} \ \ \ \
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()