【发布时间】:2021-11-23 04:02:23
【问题描述】:
我正在尝试让 if/else 语句在 jQuery 中工作。 根据用户在我们平台上的选择,.card-decorator-brand-curve 会添加 card-decorator-stroke 或 card-decorator-stroke-none。
card-decorator-stroke 按我的意愿工作,但 card-decorator-stroke-none 没有。
JS 下面:
$('.card-decorator-brand-curve').each(function() {
if ($(this).find('card-decorator-stroke')) {
$(this).removeClass('card-decorator-stroke');
$(this).addClass('brand-curve-stroke');
console.log("test me");
} else {
$(".card-decorator-stroke-none").removeClass('brand-curve-stroke');
console.log("test me 2");
}
});
非常感谢任何帮助我进行此修复的帮助。
谢谢
【问题讨论】:
标签: javascript html jquery css