Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

101
Views
Javascript: "Uncaught SyntaxError: Identifier starts immediately after numeric literal"

I am getting the error "Uncaught SyntaxError: Identifier starts immediately after numeric literal". As I understand, this is from the variable identifier starting with a number, which I'm trying pass through in the function. I saw here to use escape identifiers, but there was no concrete solution on how to add them in when using PHP, which I am having difficulty implementing.

Html

<button class = "btn btn-primary edButton" onclick='edit_function(\""<?php echo $var; ?>"\\")'>action</button>

Js

function edit_function(id) {
...
7 months ago · Santiago Gelvez
1 answers
Answer question

0

You can't start a variable in JavaScript with a digit. There is no way to escape it.

7 months ago · Santiago Gelvez Report
Answer question
Find remote jobs