mercredi 13 juillet 2016

Why jquery selector alway return true in If condition? [duplicate]

This question already has an answer here:

Why does this always return true?

<input type="checkbox" name="c1" id="c1" value="&controls=0">Hide Controls

if ($('input[name=c1]:checked')){ 
    var controls = $('#c1').val();  
} else { 
    var controls = ""; 
}
alert(controls);

Is it a problem with value? But as you see I need a value...

Aucun commentaire:

Enregistrer un commentaire