Home > Article > Web Front-end > Use js traversal to add column classes, add css and then click other implementation methods to delete css
This article mainly introduces the example code of js traversal, adding column class, adding css and then clicking on other to delete css. It is very good and has certain reference value. Friends who need it can refer to the specific code
As follows:
//js遍历添加栏目类添加css 再点击其它删除css $(".radio-group .ckselect").each(function(index) { $(this).click(function() { var tagid=$(this).attr('tagid'); $("#tagid").val(tagid) $(".ckselect").removeClass("selected"); $(".ckselect").eq(index).addClass("selected") }) });
//js点击显示关闭层,空白区域也关闭 $(".zu-top-nav-userinfo").click(function(e) { if ($(".peoples").hasClass("allhide")) { $(".peoples").hide(); $(".peoples").removeClass("allhide"); return } e.stopPropagation(); $(".peoples").show(); $(".peoples").addClass("allhide") }); $(document).click(function() { if ($(".peoples").hasClass("allhide")) { $(".peoples").hide(); $(".peoples").removeClass("allhide") } });
The above is the entire content of this article. I hope it will be helpful to everyone’s study. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
How to upload multiple H5 images under Angular
The above is the detailed content of Use js traversal to add column classes, add css and then click other implementation methods to delete css. For more information, please follow other related articles on the PHP Chinese website!