mercredi 7 juin 2017

using a jquery if condition on a span tag to show hide a div element

I am trying the following script to detect changes on a span tag and then show or hide a div element. For some reason the if statement is not working. I don't get any errors in my browser and not much information on what can be wrong with it.

$('#ch1').on('change',function(){
if('#ch1' > 6) {

        $('#box1').hide(2000);
} else {
        $('#box1').show(2000); 
}

});

Aucun commentaire:

Enregistrer un commentaire