kenny
kenny

Reputation: 37

Content does not change value on innerhtml

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

Answers (2)

GMB
GMB

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

Saikrishna Rajaraman
Saikrishna Rajaraman

Reputation: 3273

Actually its innerHTML and not innerHtml

Upvotes: 2

Related Questions