There is 2 parts which are needed for your question
The first part is as
jimmson stated in their solution; use the
innerText
property to
set the value.
But this will not work with your code as is; as there is nothing calling your
ShowHelloMessage()
function. You will need to add an
event property to your button to say what to do when the button is clicked
<button id="clickMe" onclick="ShowHelloMessage();">Click Me</button>
You will notice the empty parenthesis in both the function and the event calling it. You could place a variable name in the function itself there and
pass that value on the button itself
<script>
function ShowHelloMessage(NewMessageValue) {
var GetText = document.getElementById("clickMe");
GetText.innerText = NewMessageValue;
}
</script>
<button id="clickMe" onclick="ShowHelloMessage('Mike was here!');">Click Me</button>