Tuesday, April 24, 2018

In Firefox, getting error in console “XML Parsing Error: mismatched tag” for input

Leave a Comment

I am getting the following error when opening up my page in Firefox (other browsers don't show this error). I am using HTML5 and if I try to put closing tags on the input, then the page fails validation.

enter image description here

<!DOCTYPE html>  <html>   <head>     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">     <meta http-equiv="X-UA-Compatible" content="IE=Edge" >     <!--... more here...-->   </head>   <body>     <!--... more here...-->     <input type="text" id="wall_color_picker" onclick="startColorPicker(this)" title="Wall Color" value="#FFFFFF">     <!--... more here...-->   </body> </html> 

4 Answers

Answers 1

Because your <input>has no content allot of times people do not close the tag <input></input> but in your case close it at the end of it like so <input type="text" id="wall_color_picker" onclick="startColorPicker(this)" title="Wall Color" value="#FFFFFF"/>

Please try the following,

    <!DOCTYPE html>  <html>   <head>     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">     <meta http-equiv="X-UA-Compatible" content="IE=Edge" >     <!--... more here...-->   </head>   <body>     <!--... more here...-->     <input type="text" id="wall_color_picker" onclick="startColorPicker(this)" title="Wall Color" value="#FFFFFF"/>     <!--... more here...-->   </body> </html> 

Hope this helps

Answers 2

TL;DR Your browser is reading your html in an older format

It would seem that your browser is reading your code in the XHTML format which requires strict tags among other things. Ensure that your firefox is up to date, and also replace this line:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 

with this:

<meta charset="utf-8"> 

Reason:

This is another element that’s been simplified since XHTML and HTML4, and is an optional feature, but recommended. In the past, you may have written it like this

Answers 3

It seems the Firefox version issue. I have tried that code snippet in Firefox 43.0.1 and found OK. You can please update the Firefox version.

Answers 4

The reason you are getting the error is because you are missing meta data at the start of your file. You need to add:

<!DOCTYPE html>

at the beginning of the file.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment