Answers for "js child with class"

1

javascript get child element by class

// get child element of #test with class my-class
var testContainer = document.querySelector('#test');
var childNodeByClass = testContainer.querySelector('.my-class');
Posted by: Guest on March-08-2021
0

how to select a class and then change the children of that class with javascript

//First store your class inside a variable and then select it with query selector
var x = document.querySelectorAll('.location-address');
x[0].innerHTML += '<br><a href="https://www.yahoo.com">';
x[1].innerHTML += '<br><a href="https://www.google.com">';
x[2].innerHTML += '<br><a href="https://www.microsoft.com">';
Posted by: Guest on November-20-2020

Code answers related to "js child with class"

Code answers related to "Javascript"

Browse Popular Code Answers by Language