我目前有一个标题和一个切换按钮,它将在点击时展开。在点击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或类上的切换正在进行,并将其添加到在你的问题出在锚标记,否则将更好地帮助你,如果你分享全码 –