Answers for "js create element innerhtml"

4

javascript innerhtml

document.getElementById("example").innerHTML = "Paragraph changed!";
Posted by: Guest on October-03-2020
1

javascript create node from innerhtml

function createElement( str ) {
    var frag = document.createDocumentFragment();

    var elem = document.createElement('div');
    elem.innerHTML = str;

    while (elem.childNodes[0]) {
        frag.appendChild(elem.childNodes[0]);
    }
    return frag;
}
Posted by: Guest on March-02-2020
5

js innerHTML

document.getElementById("Test").innerHTML = "<p style='color:red;'>Test</p>";
Posted by: Guest on December-04-2020
0

js create element innerhtml

function createElement( str ) {
    var frag = document.createDocumentFragment();

    var elem = document.createElement('div');
    elem.innerHTML = str;

    while (elem.childNodes[0]) {
        frag.appendChild(elem.childNodes[0]);
    }
    return frag;
}
Posted by: Guest on July-22-2021

Code answers related to "js create element innerhtml"

Code answers related to "Javascript"

Browse Popular Code Answers by Language