I am calling an API command("@ReportProperty2(45899,exportdata,,'16115898')@")
which returns HTML of the button but in string format and >
and <
are in >
and <
and there are double quotes are well which breaks my code at the following line:
const aaa = "@ReportProperty2(45899,exportdata,,'16115898')@";
RESULT FROM THE COMMAND:
"<button type=button class=Button onclick="openwp('1677008','RHpdFBx7GS9YGFEwFmUUCyE4Ih8lHyA!H2JbUENBa1BV')" ><i class="fa fa-pencil-square-o" style="margin: 0 4px 0 0"></i>Enter Budget</button>"
I have tried replacing but it is throwing "unexpected token: identifier" error.
How can I convert the result to the following:
<button type="button"
class="Button"
onclick="openwp('1677008','RHpdFBx7GS9YGFEwFmUUCyE4Ih8lHyA!H2JbUENBa1BV')">
<i class="fa fa-pencil-square-o"
style="margin: 0 4px 0 0"
data-original-title=""
title="">
</i>
Enter Budget
</button>
I tried Lodash unescape,decodeHTMLEntities by Slavik Meltser, decodeEntities but it doesn't work.