Search code examples
javascriptphponclickfirebug

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?


Solution

  • 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.