I am just putting some html in a var and I get this error:
Uncaught SyntaxError: Unexpected token ILLEGAL
typeForm = "Type de RDV : <br />
<input type='radio' name='rdv-type' value='0' class='rdv-type' />Client seul<br />
<input type='radio' name='rdv-type' value='1' class='rdv-type' />Client + con<br />
<input type='radio' name='rdv-type' value='2' class='rdv-type' />Visite agence<br />
<input type='radio' name='rdv-type' value='4' class='rdv-type' />Signature PV<br />
<input type='radio' name='rdv-type' value='5' class='rdv-type' />Con step<br />
<input type='radio' name='rdv-type' value='3' class='rdv-type' />Land analysis<br />";
I don’t get what I am doing wrong. I get a warning around first <br />.
I checked other posts but I really dont see why it does this.
It happens because in JavaScript you can’t simply start the new line in a string value, you should either ‘escape the new line’:
or use string concatenation: