スクリプト マネージャーと Javascript/Jquery が追加されたマスター ページがあります。下記参照:
<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>
カスタム J:
$(".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 関数を追加すると、期待どおりに動作します。ここで何が問題なのですか?
ありがとう。