Skip to content

Correction to Part III - Append New Content Outside Loop #23

Closed
@JamesDunlop

Description

@JamesDunlop

Example using createDocumentFragment should be as follows:

// better: do this
var frag = document.createDocumentFragment();

$.each(myArray, function (i, item) {
    var newListItem = document.createElement("li");
    newListItem.textContent = item;
    frag.appendChild(newListItem);
});
$('#ballers')[0].appendChild(frag);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions