How to decode HTML entities using jQuery?

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

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

19条回答
  •  耶瑟儿~
    2020-11-22 00:01

    The easiest way is to set a class selector to your elements an then use following code:

    $(function(){
        $('.classSelector').each(function(a, b){
            $(b).html($(b).text());
        });
    });
    

    Nothing any more needed!

    I had this problem and found this clear solution and it works fine.

提交回复
热议问题