how to assign a block of html code to a javascript variable

后端 未结 7 1382
天涯浪人
天涯浪人 2020-12-04 18:02

what is the syntax to store a block of html code to a javascript variable?

test.test
7条回答
  •  無奈伤痛
    2020-12-04 18:39

    we can use backticks (``) without any error.. eg:

    "test"

    we can store large template(HTML) inside the backticks which was introduced in ES6 javascript standard

    No need to escape any special characters

    if no backticks.. we need to escape characters by appending backslash() eg:" \"test\""

提交回复
热议问题