change html layout, better format number

This commit is contained in:
Xaloc 2020-06-18 22:57:25 +02:00
parent cc70b38a21
commit 789e5b645f
2 changed files with 3 additions and 2 deletions

View File

@ -25,11 +25,12 @@
<option value='GBP'>GBP</option>
</select>
<button onClick='convert()'>Convert</button>
<p>
Converted: <span id='res'></span>
</p>
<button onClick='convert()'>Convert</button>
<script src='script.js'></script>
</body>

View File

@ -13,5 +13,5 @@ async function convert(){
coef = 1;
}
var val = document.getElementById('val').value;
document.getElementById('res').textContent = val*coef + ' ' +document.getElementById('curr2').value;
document.getElementById('res').textContent = Number((val*coef).toFixed(2)).toLocaleString('en') + ' ' +document.getElementById('curr2').value;
}