It can be done by putting the backslash \
in front of the character. It can be also implemented for other character.
For exampleWe wanna inject a quotation-wrapped text for a
div
element with the id
example
below:
The JavaScript:
Result
We can also substitute the double quotation with
"
, and single quotation with '
— without using the backslash.Let's use the earlier example:
That also applicable for inserting actual
HTML
element with class
or id
or other attribute
.
Thanks for visiting!
No comments
Post a Comment