Where is the syntax error?

var $modal = "'#modal" + String($(this).attr("id")) + "'";

Error: Syntax error, unrecognized expression: '#modal0001'
June 10th 19 at 16:06
3 answers
June 10th 19 at 16:08
and if so
var $modal =`#modal${String($(this).attr("id"))}`
June 10th 19 at 16:10
the extra quotation marks
June 10th 19 at 16:12
If this is an attempt to form the object identifier for the call in the jquery selector that:
var modal = "#modal" + String($(this).attr("id"));

Find more questions by tags jQuery