Answer the question
In order to leave comments, you need to log in
How to create more than one element in pure js?
Hello everyone and I have changed the content of the question.
One element is created like this, for example:
Given:
How to create elements in an amount that matches the value of count, i.e. create 4 spans? var span = document.createElement('span');
var count = 4;
Answer the question
In order to leave comments, you need to log in
Solved the issue like this:
var i = 4;
for (i; i > 0; i--){
var div = document.createElement('span');
div.className = "span";
div.innerHTML = 'this is span';
document.body.appendChild(div);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question