October 22, 2024
Chicago 12, Melborne City, USA
HTML

Unexpected character lexer error when using template literal in HTML


I use template literal to parametrize class name in HTML:

<div class="myclass__spinner ${num ? `myclass-progress__color-${num}` : ''}">

However, I get the following error in browser console:

Uncaught (in promise) Error: Lexer Error: Unexpected character [`] at column 6 in expression [num ? `myclass-progress__color-${num}` : '']

How can this be fixed?



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video