How to decode HTML entities using jQuery?

后端 未结 19 2193
忘了有多久
忘了有多久 2020-11-21 23:21

How do I use jQuery to decode HTML entities in a string?

19条回答
  •  [愿得一人]
    2020-11-22 00:03

    Suppose you have below String.

    Our Deluxe cabins are warm, cozy & comfortable

    var str = $("p").text(); // get the text from 

    tag $('p').html(str).text(); // Now,decode html entities in your variable i.e

    str and assign back to

    tag.

    that's it.

提交回复
热议问题