javascript - Strange characters in Htmt view -
i have javascript following
<script type="text/javascript"> var login = "<sec:authentication property="principal.username"/>"; </script>
when see value of login is
abc@gmail.com.
what want must abc@gmail.com.
is there way can correct lo-gin , not weird symbols. know why such weird symbols occurring instead of proper symbols.
@
, .
html codes @
, .
respectively.
as far know there isin't native function decode such string in javascript. can use parsing ability of dom elements.
var login = (login = document.createelement('span'), login.innerhtml = 'abc@gmail.com', login.textcontent);
you can wrap functionality in function reuse:
function decodehtml(text) { var el = document.createelement('span'); return el.innerhtml = text, el.textcontent; } decodehtml('abc@gmail.com');
Comments
Post a Comment