我可以在字形点击上添加一个类,但不能删除它。这是我的fiddle
以下是我的 jQuery。我想添加一个 if 语句 if hasClass then remove else addClass "success"
jQuery(function($){
$("tbody").on("click",".questCompletion > .glyphicon-ok", function(){
$(this).parents("tr").addClass("success");
});
});
最佳答案
jQuery(function($){
$("tbody").on("click",".questCompletion > .glyphicon-ok", function(){
$(this).parents("tr").toggleClass("success");
});
});
关于javascript - 单击字形时将类添加到表行,再次单击时将其删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32059446/