I can’t use the basic $(‘#div’).html(“value”); to change the text of a div like I’m used to. Instead I’m trying to use div.setAttribute(…). Is there any way to set the “html” using it?
Sorry for the noob question, I haven’t learned to manipulate my divs in this way yet.
If you have a DOM element and not a jQuery object, you’d use
.innerHTML.If you need to append content, you could technically use:
but be very careful with that since it destroys the existing nested content and recreates it.
Better would be to create an element, append your content to that using
.innerHTML, then append the children of the new element.