rushdi
0
Q:

replace element javascript

// select the element that will be replacedvar el = document.querySelector('div');
// <a href="/javascript/manipulation/creating-a-dom-element-51/">create a new element</a> that will take the place of "el"var newEl = document.createElement('p');newEl.innerHTML = '<b>Hello World!</b>';
// replace el with newELel.parentNode.replaceChild(newEl, el);
0

New to Communities?

Join the community