natti shaha
3 months ago
3
// Function for adding elements to DOM with specific attributes
const createElement = (elementType, classToAdd, attribute, attributeValue) => {
const element = document.createElement(elementType);
element.setAttribute('class', classToAdd);
// Set attribute value based on the attribute required
attribute === 'href'
? (element.href = attributeValue)
: attribute === 'innerHTML'
? (element.innerHTML = attributeValue)
: attribute === 'innerText'
? (element.innerText = attributeValue)
: attribute === 'src'
? (element.src = attributeValue)
: undefined;
return element;
};
Loading comments...
-
1:19:43
Andy Frisella
20 hours agoTrump Winning the Election Won’t Fix All of Our Problems - Ep 772 CTI
1.97K8 -
8:16
Dr. Nick Zyrowski
1 day agoIs Fried Food Causing Brain Damage!? - New Research!
1.48K9 -
21:05
CarlCrusher
13 hours agoAncient Petroglyphs are Maps Through Another Dimension the Re-Indigenizing Minds Project
1.65K2 -
25:51
Clownfish TV
12 hours agoThe Acolyte is The Last Jedi All Over Again...
2.32K5 -
2:32:44
Steven Crowder
12 hours agoTrump Town Hall LIVE! | Louder with Crowder
375K345 -
1:56:32
The Quartering
16 hours agoDonald Trump LIVE Townhall! Roasting Kamala Harris & Live Reaction/Fact Check
135K35 -
10:13:25
Akademiks
1 day agoTravis Scott gets Robbed, Drake officially back?? Ice Spice Exposed AGAIN??? Boosie vs Ralo!
170K29 -
4:36:58
Drew Hernandez
19 hours agoTRUMP TOWN HALL & DEMS PREPARE RUSSIA HOAX IF TRUMP WINS
86.2K31 -
2:06:12
Laura Loomer
11 hours agoEP72: Tim Walz's Family Endorses Trump!
58K34 -
1:35:59
Kim Iversen
14 hours agoAre Muslim Immigrants Destroying Europe? The Hidden Agendas No One Is Talking About | Kevork Almassian
98.6K116