Reputation: 37
I'm practising javascript, though having a hard time that why the following inner html doesn't change values.
Here is my code:
<a href="#" onmousedown="bleep.play()">home</a>
<button onclick="GenerateTitle(1)">Generate</button>
<div id="div1">Default Content...</div>
JAVASCRIPT
var bleep = new Audio();
bleep.src = "sound.mp3";
function GenerateTitle(num){
bleep.play();
var div1= document.getElementById("div1");
div1.innerHtml = "load content for";
}
Upvotes: 0
Views: 78
Reputation: 337
As the above answers mentioned it should be innerHTML
Please see the code below. I have amended the code
var bleep = new Audio();
bleep.src = "sound.mp3";
function GenerateTitle(num){
bleep.play();
var div1= document.getElementById("div1");
div1.innerHTML = "load content for";
}
<a href="#" onmousedown="bleep.play()">home</a>
<button onclick="GenerateTitle(1)">Generate</button>
<div id="div1">Default Content...</div>
Upvotes: 0