I have a simple form which includes two input elements.
<form class="submitform">
<input class="remove_list_items clear_button" type="button" value="A"/>
<input id="logIn_submit" class="clear_button" type="button" value="B" />
</form>
I see the form written in the source code.
HOWEVER when I inspect the input elements (right click > inspect element / F12) the form tag simply disappears (I can also tell by the fact the input elements are 100% instead of being reduced in width by the form (via css).
What is strange is that if I COPY the form code FROM the source code (CTRL+U), edit the code via inspect element (F12) and replace the code, everything is as it should be.
Code in source code (which is working if I edit via inspect element):
<form class="submitform">
<input class="remove_list_items clear_button" type="button" value="A"/>
<input id="logIn_submit" class="clear_button" type="button" value="B" />
</form>
Code that I see via Inspect Element when the page loads (note the FORM tags are missing):
<input class="remove_list_items clear_button" type="button" value="A"/>
<input id="logIn_submit" class="clear_button" type="button" value="B" />
This is happening both in Chrome and In IE 10.
I have other forms on the page that display correctly.
Any idea why this is happening?
The HTML form tag is required when you want to collect information that visitors provide. For example, you may want to collect specific data from visitors, such as name, email address, and password. The HTML <form> tag is used to create a form.
The HTML <form> tag is used for declaring a form. The <form> tag is used in conjunction with form-associated elements. To create a form, you can nest form-associated elements inside the opening/closing <form> tags. You can also use the form attribute within those elements to reference the ID of the form to use.
Form Tag is Powerful - On the internet, the most-used tag is form tag; without form tags, the internet would be a read-only repository of boring documentation. You wouldn't even be able to search for anything on the internet without a form tag. So it plays an important role in the web for sending and receiving data.
The consensus seems to be that FORM tags are no longer required when you simply want to render a form input control. If all your input field is doing is providing a UI (user interface) hook for interactions, then you can put the input fields into the HTML without including a FORM tag.
Remove any extra open form tags that haven't been closed.
Chrome will try to fix invalid HTML and doesn't always get it right.
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