0
Opa Galera! all right? I am making a form that should be divided into two or more steps... I had the idea of using a class ". ", in the second "div" and leave it as "display: None;" in css. then I put another class with "display: block;" my idea, was to put a trigger in the last field of the first div, so when the person was in this field, he would make visible the second div.
$('#trigger').focusin(function(){
    $('.hide').addClass('isActive');
})form{
    border: 1px solid black;
    border-radius: 5px 5px;
    padding: 80px;
}
div{
    padding: 30px;
}
.hide{
    display: none;
}
.isActive{
    display: block;
}<form>
            <div class="first">
                Nome completo:<input type="text">
                dados:<input type="text">
                dados:<input type="text"/>
                dados:<input id="trigger" type="text"/>
                
            </div>
            <div class="hide">
                dados:<input type="text"/>
                dados:<input type="text"/>
                dados:<input type="text"/>
                dados:<input type="text"/>
            </div>
                
</form>I used addClass, unsuccessfully. I tried to use removeClass before adding and it didn’t work either. Would I have to rethink the way to do this?
i tried that too:$('#Trigger'). focusin(Function(){ $('div'). removeClass('. Hide'). addClass('isActive'); });
– MSHijo
but you are picking up an element with the class "Hide" that is with
display: none;and adding another class withdisplay: block;? have you ever thought that this is going to conflict?– Ricardo Pontual
Gee man, Big Brother! but then I did the following... I took the "display" from the "isActive" class and changed the jquery to : "$('#Trigger'). focusin(Function(){ $(div).removeClass('Hide') })" did not run either, I’m pretty sure I’m doing it in a dumb way...
– MSHijo
i put an example with a suggestion below. You could also simply change the
displayonly without changing the class, has several possible solutions :)– Ricardo Pontual
is then, I realized I didn’t even need the class "isActive", just delete the ". Hide" already resolves... vc says change the "display" using the ". css()"?
– MSHijo