samedi 25 avril 2015

Select concatenated: if selected option have value 1, show another select


I've this problem. I want to show another select only if I choose YES in option, that have value = 1

    <select id="select_one">
       <option value="1">Yes</option>
       <option value="0">No</option>
    </select>

    <select id="select_yes" style="display:none">
        <option>Yes</option>
        <option>No</option>
    </select>

This is the jQuery code:

jQuery("#select_one").change(function() {
    if(jQuery("#select_one option:selected").val() == 1){
        jQuery("#select_yes").css('display','block');
    }

});

I tryed to change the css class, but it doesn't work.


Aucun commentaire:

Enregistrer un commentaire