Character & is The First Character-Javascript or JQuery Error

How to fix Jquery error message: “character & is the first character of a delimiter but occurred as data javascript” if you work with javascript in XHTML document in W3C.

I have added a javascript in my comment input codes yesterday, and i have checked in W3C today it shows many errors.

It is my habit to try validating my sites, because i want all of browsers user can view my site properly.

When i check my codes, my error comes from my javascripts or jquery that i embeded before </head> sections.

First it shows me that in head sections, i can’t have span or div tag.

So i delete the span, div and any other attributes, the result was not different -failed on validating.

The message error.

Here is the solution:

If you have XHTML documents, your document can’t handle Javascript, so you have to add some codes in your code.

The code will look like this:

<script type="text/javascript">
your jquery or javascript function codes goes here.

Save your documents and you will be successfully validating your site :D

Share the knowledge
Share on Google+0Tweet about this on TwitterShare on Facebook0Pin on Pinterest0Share on Reddit0Email this to someonePrint this page