Click here to Skip to main content
15,879,474 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I enter this jQuery code and none of the buttons Toggle their respective Panels.
JavaScript
<script type="text/javascript" src="C://Scripts/jquery-1.4.1.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
    $(function () {
        $(".panel-btn").on('click', function () {
            var panelID = $(this).attr("data-panelid");
            $('#' + panelID).fadeToggle(200);
        });
    });
</script>

...
ASP.NET
<input type="button" id="Button5" class="panel-btn" data-panelid="Panel5" runat="server" value="Button5" />
<input type="button" id="Button6" class="panel-btn" data-panelid="Panel6" runat="server" value="Button6" />
<input type="button" id="Button7" class="panel-btn" data-panelid="Panel7" runat="server" value="Button7" />
<input type="button" id="Button8" class="panel-btn" data-panelid="Panel8" runat="server" value="Button8" /><br /><br />
    <asp:Panel ID="Panel5" style="display:none" runat="server">123</asp:Panel>
    <asp:Panel ID="Panel6" style="display:none" runat="server">456</asp:Panel>
    <asp:Panel ID="Panel7" style="display:none" runat="server">789</asp:Panel>
    <asp:Panel ID="Panel8" style="display:none" runat="server">000</asp:Panel>
Posted

1 solution

There is no such thing as "jQuery command". To solve your problem, start with the simplest sample script shown in this article: http://learn.jquery.com/about-jquery/how-jquery-works[^].

The top of the scrip should handle $(document).ready.

I did not check up the rest of it (your selectors look correct), but this is how jQuery helps you to handle click:
http://api.jquery.com/click[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900