2

I got an Javascript code like this:

divElement.appendChild(document.createTextNode("Optie " + inputNumber + ": "));

Now I would like to put "Optie " and ": " in h7 tags.

How can i do this?

6
  • @BalaR - I guess so, his title says Javascript Commented Oct 19, 2011 at 13:16
  • Yea i do :) Sorry for the confusion :). Commented Oct 19, 2011 at 13:18
  • h7 tags?! the range is from 1 to 5! Commented Oct 19, 2011 at 13:22
  • What are h7 tags? You must be new to HTML. @daveoncode, tags range from 1-6 Commented Oct 19, 2011 at 13:22
  • 1
    ops! falled in the same error :P 1 to 6... anyway there is not h7 tag :P Commented Oct 19, 2011 at 13:26

2 Answers 2

5

there is no "h7". Max is H6

newHeadline = document.createNode( 'h6' ); newHeadline.createTextNode("Optie " + inputNumber + ": ") divElement.appendChild( newHeadline );

Sorry, the right code:

newHeadline = document.createElement( 'h6' );
text = document.createTextNode("Optie " + "ddd"+ ": ")
divElement.appendChild( newHeadline.appendChild( text ) );
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! Well i know max is H6 normally, but you can define as much H tags as you want just declare them in ur css. But thanks for this answer :D.
Uhm tried it, but didn't work out that great. tried maerics code and it worked perfectly. But thanks anyway.
2
var myHeader = document.createElement("h5");
myHeader.innerHTML = "Optie " + inputNumber + ":";
myHeader; // => <h5>Optie 123:</h5>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.