Question

[Solved] Using “&times” word in html changes to ×

I am using the following code.

HTML Code :

<div class="test">&times</div>

Javascript:

alert($(".test").html());

I am getting × in alert. I need to get &times as result.
Anybody knows or faces this problem? Please update your suggestions.

Enquirer: Mathi

||

Solution #1:

You need to escape:

<div class="test">&amp;times</div>

And then read the value using text() to get the unescaped value:

alert($(".test").text()); // outputs: &times
Respondent: Strille

Solution #2:

You need to escape the ampersand:

<div class="test">&amp;times</div>

&times means a multiplication sign. (Technically it should be &times; but lenient browsers let you omit the ;.)

Respondent: RichieHindle

Solution #3:

I suspect you did not know that there are different & escapes in HTML. The W3C you can see the codes. &times means × in HTML code. Use &amp;times instead.

Respondent: Ryan de Vries

Solution #4:

&times; stands for × in html.
Use &amp;times to get &times

Respondent: Ashik Jyothi

Solution #5:

Use the &#215 code instead of &times
Because JSF don’t understand the &times; code.

Use: &#215 with ;

This link provides some additional information about the topic.

Respondent: M. Nashath

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy