I would like to know how I can make the sum but eliminate or disregard the "R $", turning it into a number.
The values in R $ are generated automatically by the system.
Follow the code:
<html><head>
<script type="text/javascript">
window.onload = function (){
document.querySelector('div.de').id = 'de';
document.querySelector('div.por').id = 'por';
document.querySelector('div.economize').id = 'economize';
var Div = document.createElement("div");
document.body.appendChild(Div) ;
Div.id = 'resultado';
var Campo1 = document.getElementById("de") .innerHTML ;
var Campo2 = document.getElementById("por") .innerHTML ;
var Campo3 = document.getElementById("economize") .innerHTML ;
var subtracao = eval(parseInt(Campo3) / parseInt(Campo1) * 100);
document.getElementById('resultado').innerHTML = subtracao.toFixed(1)+"%" ;
}
</script>
</head>
<body>
<div class="de"> R$ 266,00 </div>
<div class="por"> R$ 145,36</div>
<div class="economize"> R$ 120,64</div>
</body></html>