vendredi 18 janvier 2019

jQuery switch statement with "contains" condition

I would like to test if a certain element contains some string in a switch statement. My code is similar to the following:

jQuery("#selector").on( "ajaxSuccess", function() {
    var myVar = jQuery(this).is(':contains("some string")');
    switch (myVar){
        case ':contains("some string")': jQuery([do something here]);
        break;
    }
}); 

but it does not work. What am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire