I want to convert certain entities to their entity numbers, using javascript. Is there a function to do this? Could I do it for some specific entities?
Example:
I want to output the € entity as its html-entity number: €
in the console.
Here is the JSFiddle
html
<div>I want to retreive the euro character from the button, get the html code that belongs to it and output it in the console.log. So the console.log should state: "Euro-symbol: (html code here)!!!"</div>
<button id="alt-char">Euro-symbol: €!!!</button>
javascript
var a = document.getElementById('alt-char').innerHTML;
console.log(a);