How to ADD/CHANGE HTML using JavaScript 🛠️

preview_player
Показать описание
#JavaScript #html #tutorial

00:00:00 setup
00:01:10 h1 element
00:09:32 list items

// STEP 1 CREATE THE ELEMENT

// STEP 2 ADD ATTRIBUTES/PROPERTIES

// STEP 3 APPEND ELEMENT TO DOM

// REMOVE HTML ELEMENT
Рекомендации по теме
Комментарии
Автор

// EXAMPLE 1 h1 ELEMENT

// STEP 1 CREATE THE ELEMENT
const newH1 =

// STEP 2 ADD ATTRIBUTES/PROPERTIES
newH1.textContent = "I like pizza!";
newH1.id = "myH1";
newH1.style.color = "tomato";
newH1.style.textAlign = "center";

// STEP 3 APPEND ELEMENT TO DOM
document.body.append(newH1);
//
//
//

// const box4 =
// document.body.insertBefore(newH1, box4);

// const boxes =
// document.body.insertBefore(newH1, boxes[0]);

// REMOVE HTML ELEMENT
//
//

// EXAMPLE 2 li ELEMENT

// STEP 1 CREATE THE ELEMENT
const newListItem =

// STEP 2 ADD ATTRIBUTES/PROPERTIES
newListItem.textContent = "coconut";
newListItem.id = "coconut";
newListItem.style.fontWeight = "bold";
= "lightgreen";

// STEP 3 APPEND ELEMENT TO DOM

//
//
//

// const banana =
// document.getElementById("fruits").insertBefore(newListItem, banana);

// const listItems = li");
// document.getElementById("fruits").insertBefore(newListItem, listItems[1]);

// REMOVE HTML ELEMENT
//
//

BroCodez
Автор

BroCode, i have been followed your channel for like 4 years now, i just want to say Thank you, hope you are financially stable to keep being this way and helping providing knowledge to people.

acecool
Автор

I know these functions, but I still like to watch it, how great it is explained, and sometimes I learn some detail... it's perfect, thank you

danielgago-sk
Автор

Hey this video came across my recommendation and i want to thank you. i started programming by watching your HTML video maybe 3-4 years ago as a 11th student and now i am doing Bachelors in Computer Application also earning as a student to fullfil my expenses and also help my family financially. Love all the way from Nepal❤❤

raghabpandit
Автор

You are a lifesaver man. Just now you're appreciated.

chrish.
Автор

coolest dude on YouTube!! I have learnt so much

unknown-rcvp
Автор

I am almost done with this course, today is day 4. Thank you bro

defnotdev
Автор

I was searching for this kind of tutorial. Tysm!

nastyroid
Автор

your voice hasn't changed in 2 years

GuyFromTiktokLOL
Автор

I beleive that it works it just won't for me, I'm trying to make a to-do site, made an onclick event for a button wch I made a function for, in that function, I appended my div element but it won't work, please help me !

KarlexanderStudios