简体   繁体   中英

javascript alert box show html currency symbol

How to show html currency symbol in javascript alert box. I am showing the message where currency and price both are dynamic so i need to get currency from html codes. Please provide me a solution.

<p id="eu">&euro;</p>

<script type="text/javascript">
var txt = document.getElementById("eu").textContent || document.getElementById("eu").innerText;

alert(txt);
</script>

NOTE: HERE you can find html entities

It all depends on which currency sign you want. The generic ¤ CURRENCY SIGN is \\xA4 ...

Use \\xA3 to represent £ , \€ to represent , and for more just use the handy tool called Character Map.

字符表

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM