How to decode HTML entities using jQuery?

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

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

19条回答
  •  离开以前
    2020-11-22 00:05

    Alternatively, theres also a library for it..

    here, https://cdnjs.com/libraries/he

    npm install he                 //using node.js
    
      //or from your javascript directory
    

    The usage is as follows...

    //to encode text 
    he.encode('© Ande & Nonso® Company LImited 2018');  
    
    //to decode the 
    he.decode('© Ande & Nonso® Company Limited 2018');
    

    cheers.

提交回复
热议问题