I am looking to create random numbers that are not integers, for example 2.45, 2.69, 4.52, with a maximum of two decimal places.
Currently, the generated number includes many decimal places like 2.213123123123 but I would like it to be displayed as 2.21.
Additionally, when clicking on another button, it reverts back to the previous value instead of generating a new one.
var button = document.createElement("button");
button.innerHTML = "Click";
button.onclick = function myFunction() {
var input = document.getElementsByClassName("has-input")[1];
input.value = Math.random(Math.random() * 100) + 2;
}
document.getElementsByClassName("place_bet m_t_30 bbb manual_bet_select")[0].appendChild(button);
Furthermore, upon clicking the "btn btn_green" button (on the site), it resets to the old value.