Jump to content
Killersites Forums

Recommended Posts

I'm a beginner learning JavaScript course. Not sure this is the right place to post this topic or not. Please bear with me.

 I have a little project in mind.

I want to do somthing like this:

<div id="typingfield" class="lightgreybackground">
using this:
<div id="typingfield" class="lightgreybackground">
  <script type="text/javascript">
   var para = document.createElement("p");
var cha = document.createElement("cha");
var element = document.getElementById("typingfield");
var text;
var node;
for (i = 0; i < 40 ; i++){
for (i = 0; i < 40 ; i++){
node = document.createTextNode(i);
but I got this:
<div id="typingfield" class="lightgreybackground">
Please give me some guidance.
Link to post
Share on other sites

If you want to create a set of tags, you need to create elements/tags ... for example:

var para = document.createElement("p");
var node = document.createTextNode("This is new.");

So that means, for every tag, you need to create a new element. 

  • Upvote 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...