Skip to content Skip to sidebar Skip to footer

Show/hide Section Based On Dropdown -js

Hi all I got my code all nice and pretty but the problem is that it is a bit buggy. When you select the field that actually un-hides a section and then another one that hides it- t

Solution 1:

If you select '2' it doesn't hide at all. You only want to show it if aval==1 right? So change if (aval == "0") { to else {

functionshow(aval) {    
    if (aval == "1") {//if 1 then show it
        optionyes.style.visibility='visible';
        optionyes.style.display='block';
        Form.fileURL.focus();
    } 
    else {//for everything else hide it
        optionyes.style.visibility='hidden';
        optionyes.style.display='none';
    }    
}

http://codepen.io/anon/pen/ywcqf

Post a Comment for "Show/hide Section Based On Dropdown -js"