I'm really new to JS and jQuery, but I try adding a class "hide" to an element if it has a data attribute with a specific string. So if "class" hat a data-rating attribute of "0.0", the class "hide" should be added. It doesn't work and I don't know why.
$(document).ready(function() {
if ($(".class").data('rating') === ('0.0')){
$(".class").addClass('hide');
}
});