jeudi 12 juillet 2018

Laravel text form onchange

I have a form and depending if a text input is filled, another one will appear.

My HTML

<div class="col-sm-3">
    <div class="form-group">
        
        
    </div>
</div>
<div class="hidden" id="personal_extra_cantidad">
    <div class="col-sm-3">
        <div class="form-group">
            
            
        </div>
    </div>
</div>

My script

function personal_extra() {
    var x = document.getElementById('personal_extra').value;
    var y = document.getElementById('personal_extra_cantidad');
    if (x == null) {
        y.className = "hidden";
    } else {
        y.className = "visible";
    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire