我通过在其元素中添加 show 来在引导程序中打开下拉菜单,效果很好。我也试图关闭其他打开的下拉菜单,这就是这个函数的作用。我的功能:
function classremove() {
var doesithavetheclass = $('div').hasClass('show');
if (doesithavetheclass == 'true') {
$('div').removeClass('show');
};
return doesithavetheclass;
};
这if是不起作用的部分。if在作品中运行代码,并在 Chrome 控制台中定义变量可以正常工作,但是if即使在我使用 show 类打开下拉菜单定义变量之前,在 Chrome 控制台内部运行也不起作用。
阿晨1998
相关分类