How to print a pound “£” in html file?

前端 未结 7 1253
再見小時候
再見小時候 2021-01-21 06:43

i am trying to display a pound sign in my html page.i want to display it through a variable because i am getting the values of sign from an xml file.

Here is Code:

7条回答
  •  误落风尘
    2021-01-21 07:25

    Try using:

    var sign = '£'
    $('#monthly_Amt').html("\'"+sign+"\'"+monthlypayment);
    

    For the £ sign use: £ (ASCII Code)

    http://jsfiddle.net/seckela/7gjF5/

    EDIT: Using .text() will render the literal text, .html interprets it as an HTML element and will render special ASCII Characters using the ASCII codes.

提交回复
热议问题