Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

append child at the top

// Source: https://stackoverflow.com/a/45656684/4558910
// Idea: "Gibolt" https://stackoverflow.com/users/974045/gibolt
const div = document.querySelector('div');	// select the parent
const p = document.createElement('p');	// create or select the child
p.textContent = 'Some Text!';	// add some juicy text to it
div.prepend(p);	// prepend the child at the top of the parent

// Basically what that means is:
parent.prepend(child)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #append #child #top
ADD COMMENT
Topic
Name
8+9 =