【发布时间】:2019-10-29 16:19:02
【问题描述】:
我已使用此代码隐藏和显示元素,但我的 JQuery 代码在 else 语句中无法在 chrome 中运行,但在 Firefox 浏览器中可以正常运行。
Code
$(document).ready(function(){
$(".item-title").on("click",function () {
$(this).next('div').children().toggle();
$(this).children().children('.fa-plus-square').hide()
$(this).children().children('.fa-minus-square').show()
if ($(this).next('div').children().is(':hidden')){
$(this).addClass('bb')
}
else {
$(this).removeClass('bb')
}
})
不要在 if 语句中删除类
【问题讨论】:
标签: jquery google-chrome if-statement conditional-statements