HTMLCSS_noob
HTMLCSS_noob

Reputation: 97

JSLint message: "expecting expecting <\/ instead of <\ " -What is the reason(s) for that error?

I was using JSLint to validate my code and i received the following error:

"expecting </ instead of <\"

I got that for my HTML code and JavaScript code. For example:

element.innerHTML += "<p>here's what happened: You are <b>" + aVariable + " </b> years old.</p>";

and:

<input type="text" name="enterText" id="nameOfPerson" onblur="submitValues(this)" size="50"  value="Enter your name"/>

Can anyone tell me why this is happening?

Upvotes: 1

Views: 269

Answers (1)

PanCrit
PanCrit

Reputation: 2718

In the JSLint section on HTML, it says:

JSLint also checks for the occurrence of '</' in string literals. You should always write '</' instead. The extra backslash is ignored by the JavaScript compiler but not by the HTML parser. Tricks like this should not be necessary, and yet they are.

Upvotes: 2

Related Questions