Skip to content
Jsp실무 경험

How to Use Variables in Template Literals (``) in JSP

1 min readWorkMoved from my Tistory blogRead the Korean original

While writing a function in a JSP environment, not React, I had trouble: the values passed in as variables printed fine in console.log(), but did not come out correctly when I used the variables.

A senior coworker showed me the fix, and applying it as below solved the problem.

js
function markPosition(mark, target){
     let markBox = document.querySelector(`.markBox\${target}`);
}
  • #JSP
  • #Template literals
  • #``
  • #Variables
  • #Output Error
  • #Template Literal Error

More in Work