Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In proper HTML, must an <input> be in a <form>?

I need a few input elements, but their values won't be submitted anywhere - they're just going to be manipulated by some client-side JavaScript. Do I have to place them in a <form> to have legit HTML, or can they just be free-standing?

like image 742
Claudiu Avatar asked May 19 '10 00:05

Claudiu


People also ask

Does a HTML input have to be in a form?

Yes, you can have a valid input without a form.

What is input in HTML form?

The <form> element is a container for different types of input elements, such as: text fields, checkboxes, radio buttons, submit buttons, etc.

How do you make a proper form in HTML?

Step 1: Firstly, we have to type the Html code in any text editor or open the existing Html file in the text editor in which we want to create the registration form. Step 2: Now, we have to place the cursor at that point where we want to create a form between the starting and closing of <body> tag in the Html document.

How do you put inputs in HTML?

<input type="radio"> <input type="range"> <input type="reset"> <input type="search">


1 Answers

No. You only need a form if you're submitting to a server.

like image 85
Robusto Avatar answered Oct 04 '22 18:10

Robusto