Michel
Michel

Reputation: 308

Onclick SyntaxError: identifier starts immediately after numeric literal

I have an onclick function:

onclick='deleteRow(".$bon['Werkbonnummer'].");updateVak(".$bon['Stellingvak'].");)'`<br/>
<br/>
Implemented in:<br/>
echo "<td><button class='delete' onclick='deleteRow(".$bon['Werkbonnummer'].");updateVak(".$bon['Stellingvak'].");)'>Klaar</button></td></tr>";`<br/>

When I push the button, FireBug gives me this error:

SyntaxError: identifier starts immediately after numeric literal
deleteRow(71);updateVak(4D);)`<br/>
`-----------------------^

<br/><br/>

Can somebody point out what I did wrong?

Upvotes: 1

Views: 6137

Answers (1)

bfavaretto
bfavaretto

Reputation: 71939

4D is not a valid number. If you want it to be handled as a string, you must surround it with quotes ("4D"). If you want it to be handled as an hex number, use 0x4D.

Upvotes: 5

Related Questions