Hot to prevent .text to escape the html tags on the browser?

前端 未结 2 364
野的像风
野的像风 2021-01-28 15:44

The following code apparently escapes the HTML tags and prints

Full Membership - 1 Year:$25

on the Bro

相关标签:
2条回答
  • 2021-01-28 15:58

    try .html :-

    $(".ms_total").html("<p>Full Membership - 1 Year:<span>$25</span></p>");   
    

    As documented in official site :-

    Get the HTML contents of the first element in the set of matched elements or set the HTML contents of every matched element.

    0 讨论(0)
  • 2021-01-28 16:03

    Use .html insted of .text. Because .text displays the contents which is in quotes

    DEMO

    0 讨论(0)
提交回复
热议问题