What is the use of form tag if input can be given without using form element? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the use of form tag if input can be given without using form element?

https://code.sololearn.com/W3PC9Ml2r4tg/?ref=app

17th Apr 2019, 1:37 AM
Krishna Kumar
Krishna Kumar - avatar
3 Answers
+ 2
Typically the form is on a page because we want to post their values to an action. <form method="post" action="save.aspx"> It's not technically needed.
17th Apr 2019, 3:02 AM
Dan Stewart
Dan Stewart - avatar
+ 2
Dan Stewart is correct. Without the form tag, a form can’t be submitted. One example of where someone might use form inputs without the form tag is if you want an interactive page that uses javascript to do things based on form field changes. You could add something like onchange to perform a javascript action when a form field value is changed.
17th Apr 2019, 3:22 AM
Mike
Mike - avatar
+ 2
Thanks Dan Stewart and Mike
17th Apr 2019, 3:50 AM
Krishna Kumar
Krishna Kumar - avatar