The document type does not allow the use of the element "img" / "font" here

I am trying to check my xhtml and I have a little problem with this:

At the end of the document, I have this little JS script that contains the IMG and FONT tags, and I get an error for this: the document type does not allow the use of the "img" element; the document type does not allow the use of the "font" element here

$("#nick_name").change(function()
 {var usr=$("#nick_name").val();if(usr.length>=4)
 {$("#status").html('<img src="images/loader.gif" align="middle" alt="" title=""/>');
.
.
.

How can I check this?

Thank.

+3
source share
1 answer

Put the script in CDATA for verification; more details . I found this to be good practice when working with javascript and validation.

Something like that

<script type="text/javascript">
<![CDATA[

$("#nick_name").change(function()
 {var usr=$("#nick_name").val();if(usr.length>=4)
 {$("#status").html('<img src="images/loader.gif" align="middle" alt="" title=""/>');
.
.
.
]]>
</script>
+7
source

Source: https://habr.com/ru/post/1734382/


All Articles