I need to show the results of the functions in the textarea as a log.
The code as it shows it works in the textarea but if we press another function it overwrites the previous one, I need to show them both and that the most recent functions executed are shown above.
<!DOCTYPE html>
<html>
<body>
<!-- If you click on 'myFunction()' and then on 'myFunction2()' the result would be:
Function2
Function1
-->
<textarea id="myTextarea"></textarea>
<br>
<button type="button" onclick="myFunction()">Try it</button>
<button type="button" onclick="myFunction2()">Try it</button>
<script>
function myFunction() {
var x = "Function1";
document.getElementById("myTextarea").innerHTML = x;
}
function myFunction2() {
var z = "Function2";
document.getElementById("myTextarea").innerHTML = z;
}
</script>
</body>
</html>