Using “×” word in html changes to ×

后端 未结 5 1621
天涯浪人
天涯浪人 2020-12-23 11:25

I am using the following code.

HTML Code :

×

Javascript:

alert($(\".         


        
相关标签:
5条回答
  • 2020-12-23 12:00

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

    0 讨论(0)
  • 2020-12-23 12:06

    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 &times instead.

    0 讨论(0)
  • 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 ;.)

    0 讨论(0)
  • 2020-12-23 12:16

    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.

    0 讨论(0)
  • 2020-12-23 12:21

    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
    
    0 讨论(0)
提交回复
热议问题