I am using JavaScript to extract values from some <input>
elements in my page.
Do I need to wrap all my <input>
elements in <form>
elements?
What will happen if I do not?
Does it give access to some better features?
No you don't.
The form is used to send data to the server, like some kind of search mask to query a database.
You can put all your input tags in one form tag.
There are some advantages using a form:
Rule of thumb: If you have some input elements that logically belong together, then put them in a form. To process the data you can either use javascript (onsubmit) or you can send it directly to the server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With