How to use encoded HTML text within string literals?

I am trying to include a HTML encoded special character within a string literal, but it will not render as HTML in the final document.

I am trying to do it like such:

const head = { 
title: `${ApplicationName} - ${Slogan}™`

In the above code the ™ part it supposed to render a trademark symbol like ™. But when this code makes it into the HTML document it ends up rendering as a string:

  <title>Imaginary Inc - We straight don't exist&trade;</title>

Is there any way to get it to work, maybe using some kind of escaping technique?

Source: JavaSript – Stack Overflow

November 29, 2021
Category : News
Tags: encoding | html | javascript

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.