我有一个母版页,其中添加了脚本管理器和Javascript/Jquery。请看下图:自定义jQuery显示/隐藏div JS不能在ASP.Net工作
<asp:ScriptManager ID="SM" runat="server" EnablePartialRendering="true">
<Scripts>
<asp:ScriptReference Path="~/Scripts/jquery-1.7.2.min.js" ScriptMode="Release" />
<asp:ScriptReference Path="~/Scripts/Custom.js" ScriptMode="Release" />
</Scripts>
</asp:ScriptManager>
自定义JS:
$(".section").click(function() {
if ($(this).next(".sectiondetail").is(":hidden")) {
$(this).next(".sectiondetail").slideDown("slow");
$(this).children('span').text('[-]');
} else {
$(this).next(".sectiondetail").slideUp("slow");
$(this).children('span').text('[+]');
}
});
我把跟随我的ASCX控制HTML是在内容页中添加使用我的母版页:
<div class="section">
<span>[+]</span> General Information
</div>
<div class="sectiondetail" style="display: none;">
Details go here.
</div>
的JS函数不能按预期工作。如果我在我的ASCX控制页面添加JS函数,它按预期工作。这里有什么问题?
谢谢。
尝试用活$( '点击',函数(){...})( “节”)。 – 2012-07-09 04:52:45