Skip to content

Instantly share code, notes, and snippets.

@rccc
Created November 20, 2014 20:22
Show Gist options
  • Save rccc/9adbc4608225a4278543 to your computer and use it in GitHub Desktop.
Save rccc/9adbc4608225a4278543 to your computer and use it in GitHub Desktop.
// jQuery
$('body').append($('<p/>'))
// Vanilla
document.body.appendChild(document.createElement('p'))

$("#container").append("<p>more content</p>");

document.getElementById("container").innerHTML += "<p>more content</p>";
$(parent).prepend(el);
parent.insertBefore(el, parent.firstChild);
// jQuery
var clonedElement = $('#about').clone()

// Vanilla
var clonedElement = document.getElementById('about').cloneNode(true)
// jQuery
$('#wrap').empty()

// Vanilla
var wrap = document.getElementById('wrap')
while(wrap.firstChild) wrap.removeChild(wrap.firstChild)
while (c.lastChild) c.removeChild(c.lastChild);
document.getElementById("container").innerHTML = null;


$("#container").remove();
var c = document.getElementById("container");
c.parentNode.removeChild(c);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment