function to create an element javascript
// A function to create elements in JS
function elementFactory(tag, text) {
const el = document.createElement(tag);
el.textContent = text;
return el;
}
const someListItem = elementFactory("li", "some text");
let p = document.createElement('p');
Also in JavaScript:
- dropdown option selection change event in jquery
- object find javascript
- Angular comment
- angularjs
- chart.js label word wrap
- string pop last char js
- sqrt javascript
- how to prevent previous radio button active react native
- sweet alert js
- laravel csrf token ajax post
- react image upload component
- delete session javascript
- mute video javascript
- javascript sort array of object by property
- node js store add values in file
- how to floor a number in javascript
- how get height elemnt with that margin in js
- drawer navigation set width react native
- jquery validator no space
- how to create a constant in javascript
- "when.promise" async await
- javascript create array of objects with map
- tinymce menubar hide
- radium is not working