When clicking the enter button on the keyboard I want the data to show but not to reset. But if I input new data and click enter I want it to run still without clicking a reset button.
function myFunction() {
var x = document.getElementById("myText").value;
document.getElementById("demo").innerHTML = "$" + (x * '.97').toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form>
<input id="myText" placeholder="$149,995.00" style="width:50%;" type="number">
<button onclick="myFunction()" type="button">Convert</button>
</form>
<h1 id="demo"></h1>
</body>
</html>