You are appending the same element over and over. You need to call document.createElement
each time you wish to have a new element.
EDIT: If the element setup is really complicated and potentially includes children then you can also use Node.cloneNode
More Related Contents:
- How to append in JavaScript? [duplicate]
- What is better, appending new elements via DOM functions, or appending strings with HTML tags?
- Javascript Append Child AFTER Element
- How to appendChild(element) many times. (The same element)
- jQuery append() vs appendChild()
- What is closure thingy without the final parentheses?
- How does JavaScript handle AJAX responses in the background?
- await is only valid in async function
- window.location.href and window.open () methods in JavaScript
- How do you check if a JavaScript Object is a DOM Object?
- Way to ng-repeat defined number of times instead of repeating over array?
- innerText vs innerHTML vs label vs text vs textContent vs outerText
- How to ‘minify’ Javascript code
- What is the difference between RegExp’s exec() function and String’s match() function?
- How do I check if a cookie exists?
- Multiple path names for a same component in React Router
- How to join two JavaScript Objects, without using JQUERY [duplicate]
- When should I use return false in jquery function?
- Why cache jQuery objects?
- What is the elegant way to get the latest date from array of objects in client side?
- Is there anything that guarantees constant time for accessing a property of an object in JavaScript?
- What’s the difference between window.location and document.location in JavaScript?
- Javascript onkeydown event fire only once?
- JavaScript setTimeOut doesn’t seem to work like I expect
- Display image from blob using javascript and websockets
- Node.js Alert Causes Crash
- Extract the text out of HTML string using JavaScript
- React Navigation how to hide tabbar from inside stack navigation
- OnChange not firing in IE
- Show values on top of bars in a barChart