1
I need to separate the form into 2 different Ivs on the same page. I tried the next one and it didn’t work:
<div id="div1">
<form method="post">
<input type="text" name="Nome">
</form>
<button onclick="exibediv2()">
</div>
<div id="div2">
<form method="post">
<input type="text" name="Cidade">
<input type="submit">
</form>
<button onclick="exibediv1()">
</div>
When I use Submit in the second form, it does not recognize the value of the first input. How to solve this?
[Added due feedback from comments]
When I leave as one
<form>
the firstbutton
acts like asubmit
.
If I understand what you need you should avoid closing the first form and creating the second. I think you need something like this https://jsfiddle.net/6szwunqm/ without the
</form>...<form>
between the Ivs.– Sergio
What function JS display1() and exibedv2() ?
– user28062
Scripts only change the position of the Divs by setting the display to block or None.
– Matheus Godoi
I also thought about it, Sergio, but when I don’t close the form, the button that should display the div 2, works like a Submit.
– Matheus Godoi