I am able to add a class on a glyphicon click but not remove it. Here is my fiddle
Following is my jQuery. I thought of adding an if statement if hasClass then remove else addClass "success"
jQuery(function($){
$("tbody").on("click",".questCompletion > .glyphicon-ok", function(){
$(this).parents("tr").addClass("success");
});
});
Use toggleClass
jQuery(function($){
$("tbody").on("click",".questCompletion > .glyphicon-ok", function(){
$(this).parents("tr").toggleClass("success");
});
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.