Untitled

mail@pastecode.io avatar
unknown
javascript
2 years ago
1.4 kB
4
Indexable
Never
<script type="text/javascript">
    window.onload = function() {
        document.getElementById('segmento').style.display = 'none';    
    }
    function mostra1() {
        if (document.getElementById('elemento1').value === "xxxxx") {
            document.getElementById('segmento-p').style.display = 'block';
            document.getElementById('segmento-f').style.display = 'none';
            document.getElementById('select2').value = '';
            document.getElementById('cota2').value = '';
            document.getElementById("select1").required = true;
            document.getElementById("select2").required = false;
            document.getElementById("cota1").required = true;
            document.getElementById("cota2").required = false;
        } 
        else if(document.getElementById('modalidade').value === "yyyyy") {
            document.getElementById('segmento-p').style.display = 'none';
            document.getElementById('segmento-f').style.display = 'block';
            document.getElementById('select1').value = '';
            document.getElementById('cota1').value = '';
            document.getElementById("select1").required = false;
            document.getElementById("select2").required = true;
            document.getElementById("cota1").required = false;
            document.getElementById("cota2").required = true;
       }
    }
</script>