You are here: Computer Video TutorialTechnologyCharacter & is The First Character-Javascript or JQuery Error

Character & is The First Character-Javascript or JQuery Error

by Kimi on October 24, 2010

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.

blog seo
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">
//<![CDATA[
your jquery or javascript function codes goes here.
//]]>
</script>

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

Subscribe new tips via Email:

Was the post helpful? Share it to help others with:

Know better? Feedbacks, or Questions? Shoot! :-)

Please use a name instead of blog name or SEO stuff, otherwise it will be deleted right away.

About checkbox → See more my post:how to get rid of spam bots in wordpress post.

Thank you for visiting, you're always welcomed to be here again!

Previous post:

Next post: