KButler
KButler

Reputation: 97

Using multiple H1 headings through javascript

I have created an <h1> heading through createElement("h1") and given it style. Within my assignment, it is stated that I need to create another <h1> heading with the title "Build Your Resume". I have created the code that I thought would work, but nothing is produced from it. I have looked around and see that it is perfectly ok to use multiple <h1> headings in HTML. I am not sure what is happening that it is not writing to the web page. Could someone please point me in the right direction? Thank you.

var elemH1 = document.createElement("h1");
elemH1.style.color = "red";
elemH1.style.fontFamily = "tahoma";
elemH1.style.textAlign = "center";
elemH1.innerText = "Kent Butler";
document.body.appendChild(elemH1);

var elemH2 = document.createElement("h2");
elemH2.style.fontFamily = "garamond";
elemH2.style.color = "red";
elemH2.style.fontStyle = "italic";
elemH2.style.textAlign = "center";
elemH2.innerText = "WEB 115.0001";
document.body.appendChild(elemH2);

var title = document.createElement("h1");
title.style.textAlign = "center";
title.innnerText = "Build Your Resume";
document.body.appendChild(title);

I am looking for the output to be written and centered. Thank you for any advice/ info.

Upvotes: 1

Views: 271

Answers (2)

Sandeep
Sandeep

Reputation: 141

You have did spelling mistake :P title.innnerText = "Build Your Resume"; innerText

Upvotes: 0

Soft Dev
Soft Dev

Reputation: 31

you made a spell error.

title.innnerText = "Build Your Resume"; should be "inner".

Upvotes: 3

Related Questions