Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function manipulate_04() {
- // DOM Manipulation_04:
- // Insert li in the DOM and specifically before
- // li in the first position
- var btn04 = document.getElementById("btn04");
- // create a new li element
- var newLi = document.createElement("li");
- var list = document.getElementById("ourList");
- // create text to display at li
- newLi.innerHTML = "This is Line 1";
- // insert li in the first position
- list.insertBefore(newLi, list.getElementsByTagName("li")[0]);
- btn04.classList.add("hide-btn");
- }
Add Comment
Please, Sign In to add comment