mardi 27 mars 2018

jQuery if data-id element hasClass not working

I don't know if the function i am trying to create is missing an element or if I am missing something but my function isn't working at all. Not sure if am missing something or if i am not adding something. let me know I provided jQuery and screenshot of the code i am trying to get to work. Basically what i am trying to do is if a certain element that has a data-id has a certain class then hide certain list-items.

$(function($){
    if( $('.chbs-vehicle[data-id="313"] a').hasClass('chbs-state-selected') ){
        $('ul.chbs-list-reset li(1)').hide();
    }
});

enter image description here

Aucun commentaire:

Enregistrer un commentaire