我目前有一個標題和一個切換按鈕,它將在點擊時展開。在點擊javascript事件應用到JSP中的標題而不是使用<a>標記
HTML:
<h3 class="toggle_header" id="Tax_information_eSignature">
<a href="javascript:void(0);" class="icon_toggle_open"></a>
<spring:message code="TaxInformation.eSignature" />
<label for="Tax_information_eSignature"></label>
</h3>
JS:
$(document).on('click', '.icon_toggle_open', function (e) {
stop(e);
$(this).removeClass("icon_toggle_open")
.addClass("icon_toggle_close")
.attr("alt","Show")
.attr("title","Show")
.parent().next('.toggle_content').hide();
$(window).blur();
});
$(document).on('click', '.icon_toggle_close', function (e) {
stop(e);
$(this).removeClass("icon_toggle_close")
.addClass("icon_toggle_open")
.attr("alt","Hide")
.attr("title","Hide")
.parent().next('.toggle_content').show();
$(window).blur();
});
我不希望點擊展開按鈕,而是點擊手風琴欄中的任意位置來觸發展開/摺疊。我是JSP新手,任何人都可以幫忙嗎?
刪除ID或類上的切換正在進行,並將其添加到在你的問題出在錨標記,否則將更好地幫助你,如果你分享全碼 –