The example in this article describes the method of modifying, adding and deleting class styles in js. Share it with everyone for your reference. The specific analysis is as follows:
A relatively common js front-end function, the corresponding function can be achieved by modifying the className of the tag.
The specific code is as follows:
<script>
$('.goods_sale_property').click(function(){//Click on a separate a tag to add class<p>
If($(this).hasClass('goods_sale_property_checked')){<br>
$(this).removeClass('goods_sale_property_checked');<br>
}else{<br>
$(this).addClass('goods_sale_property_checked');<br>
}<br>
});<br>
function selectAll(){//Select all and add class<br>
$('.goods_sale_property').each(function(i){<br>
$(this).addClass('goods_sale_property_checked');<br>
}); <br>
}<br>
function selectNotAll(){//Select all and delete class<br>
$('.goods_sale_property').each(function(i){<br>
$(this).removeClass('goods_sale_property_checked');<br>
}); <br>
}<br>
</script>
I hope this article will be helpful to everyone’s JavaScript programming design.