I have tried for following code in javascript, but I get:
identifier starts immediately after numeric literal
error is coming for following script, example mcnDel="016160A1"
<script>
mcnDel="016160A1"
var val="<a href='javascript: void(0);' onclick='removeRow("+mcnDel+");'><img src=images/delete.png></a></a></td>"
</script>
You need to wrap the string with quotes.
onclick='removeRow("+mcnDel+");'
needs to be
onclick='removeRow(\""+mcnDel+"\");'
FYI, I got that error while trying to use BigInt()
and big integer litterals (e.g. 123n
on Safari for iOS.
Dont forget Javascript id cannot start with a number, make sure the value of your variable is not starting with a number.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With