var nameuserfold = document.getElementsByClassName("option_fold");
var nameuserfoldinput = document.querySelector('input[name="namefolduser"]');
var select = document.querySelector('select[name="namefold"]');
userfold();
for (i = 0; i<= nameuserfold.length-1 ; i++) {
    nameuserfold[i].addEventListener('click', userfold);   
}

function userfold() {
    if(select.value== 'other') {
        nameuserfoldinput.classList.add("viewop");
        nameuserfoldinput.setAttribute('required',"podaj nazwe folderu" );
    } else {
        nameuserfoldinput.classList.remove("viewop");
        nameuserfoldinput.removeAttribute('required',"podaj nazwe folderu" );
    }
}