我有全局变量:
units = 0;
majorUnits = 0;
supportUnits = 0;
requiredUnits = 0;
electiveUnits = 0;
electiveUnitsStop = 0;
pending = 0;
percent = 0;
supportPercent = 0;
requiredPercent = 0;
electivePercent = 0;
我在函数上使用这个变量:
$("tr").click(function() {
$(this).toggleClass("taken");
if ( $(this).hasClass('taken') )
{ .....
然后我有第二个函数,在其中我将变量设置为零:
$( "#clear-button" ).click(function() {
units = 0;
majorUnits = 0;
supportUnits = 0;
requiredUnits = 0;
electiveUnits = 0;
electiveUnitsStop = 0;
pending = 0;
percent = 0;
supportPercent = 0;
requiredPercent = 0;
electivePercent = 0;
// $( "tr" ).click();
//$("tr").find('taken').removeClass('taken');
//$("table").closest('tr').find('.taken').removeClass('taken');
//$("tr").removeClass();
//taken.allInstances = [];
});
如上面在注释代码中所见,我正在尝试删除所有出现taken
在我的 html 表的行中可能存在或不存在的类。
我怎么能做到这一点?!?!
我真的很感激任何帮助。