Gilko
Gilko

Reputation: 2387

Replace jquery text with TM character entity, with jquery

How do I change text with TM character entity in the text, with jquery?

For example :

TM = &#8482 ; ™

<h1>Some text&#8482;</h1>

Now I want to change text on button click to 'This is some other text™'

$('#click1').on('touchend', function () {
    $('h1').text("This is some other text");
});

How can I place the ™ with jquery and how can I place it in <sup></sup>?

Upvotes: 0

Views: 326

Answers (2)

Simon H&#228;nisch
Simon H&#228;nisch

Reputation: 4968

Use .html instead of .text:

$('h1').html('This is some other text &#8482;');

Upvotes: 1

Oleksandr T.
Oleksandr T.

Reputation: 77482

Try this

$('h1').html("This is some other text <sup>&#8482;</sup>");

Example

Upvotes: 1

Related Questions