I need to show a form using a button, and hide it when the user presses another button, because the other button shows another form. I did a similar thing with a select box, but I can't figure out how to do this.
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
Would you want the same form with different parts, showing each part accordingly with a button?
Here an example with three steps, that is, three form parts, but it is expandable to any number of form parts. The HTML characters
«
and»
just print respectively « and » which might be interesting for the previous and next button characters.Use the following code fragment to hide the form on button click.
And the following code to display it:
Or you can use the same function for both purposes:
And the HTML:
There's something I bet you already heard about this! It's called jQuery.
It's really easy and you can use CSS-like selectors and you can add animations. It's really easy to learn.
If you have a container and two sub containers, you can do like this
jQuery
HTML
There's the global attribute called
hidden
. But I'm green to all this and maybe there was a reason it wasn't mentioned yet?https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/hidden