4
I am doing some initial tests with javascript, and I am not succeeding in trying to change a parameter of my HTML code. The idea is that when you click the "Message" button, the text is updated to "New Text!" Follow the HTML code and javascript:
<html>
<h1>Javascript</h1>
<h3 id="frase">Default text</h3>
<button id = "getMessage" class = "btn btn-primary"> Message </button>
</html>
$(document).ready(function() {
$("#getMessage").on("click", function(){
document.getElementById("frase").innerHTML = "New text!";
});
});
How should I integrate what is displayed in HTML with my javascript code?
Matheus, Welcome! Your question is unclear... the code you have is right and works (see here: https://jsfiddle.net/c56mg0m6/). What problem are you having to implement that?
– Sergio