I'm trying to change the value of a html input element and I want to see the value change on screen. This seems to be a very simple task but it is not working using javascript (but it work with jQuery).
$("#btn1").click(function () {
$("#test1").val("10");
});
function bt() {
document.getElementById("test1").value = "3333";
document.getElementById("test1").setAttribute("value","4444");
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<p>Formula 1:
<input type="text" id="test1" value="1111">
</p>
<p>What the answers to these formulas?</p>
<br>
<button id="btn1">Hint</button>
<button id="btn2" onclick="bt()">Hint2</button>
Any suggestion with the javascript function bt() ?