简体   繁体   English

jQuery slideToggle函数从后面的代码调用div-tag

[英]Jquery slideToggle function calling div-tag from code behind

Iam trying to do slidetoggel function(jquery) and calling the div tag from code behind. 我试图做slidetoggel函数(jquery)并从后面的代码调用div标签。 i have done that before but now its not working. 我以前做过,但现在不起作用。 All other scripts src working. 所有其他脚本src都可以工作。

Code behind

     string boxen = "<div class=\"alter-Wrp\">/div>";
        litAlert.Text += String.Format(boxen);

 asp.page    
         <script type="text/javascript">
                $(document).ready(function () {
                    $("#btn-VG").click(function () {
                        $(".alert-Wrp").slideToggle();
                    });
                }); </script>

         <button id="btn-VG">Button</button>
                <asp:Literal ID="litAlert" runat="server"></asp:Literal>

I think your html is not proper. 我认为您的html不正确。 /div> Also what are the errors ? / div>还有什么错误? Did you see it in browser's console? 您在浏览器的控制台中看到了吗?

try $(".alert-Wrp") in the console and see if it returns anything? 在控制台中尝试$(“。alert-Wrp”),看看它是否返回任何内容? Also $("#btn-Wrp").click() in console and see what happen 同样在控制台中$(“#btn-Wrp”)。click()看看会发生什么

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM