我有一个 div 对象
<div class="class1 classA classB class2"> content </div>
和一些按钮
<button id="numbers">clickme N </button>
<button id="alphas">clickme A </button>
代码应该执行此功能:
<script>
var classesN = [class1, class2, class3];
var classesAlpha = [classA, classB, classC];
$('#alphas').click(function() {
$('div').removeClass(all classes that are in the classesAlpha array);
});
$('#numbers').click(function() {
$('div').removeClass(all classes that are in the classesN array);
})
</script>
感谢您的任何建议,我希望您喜欢这个问题:)