Unescape HTML entities in Javascript?

前端 未结 30 3039
野趣味
野趣味 2020-11-21 05:40

I have some Javascript code that communicates with an XML-RPC backend. The XML-RPC returns strings of the form:


30条回答
  •  春和景丽
    2020-11-21 05:44

    For one-line guys:

    const htmlDecode = innerHTML => Object.assign(document.createElement('textarea'), {innerHTML}).value;
    
    console.log(htmlDecode('Complicated - Dimitri Vegas & Like Mike'));
    

提交回复
热议问题