B
B
barbosk2021-06-11 15:17:30
JavaScript
barbosk, 2021-06-11 15:17:30

How to refer to an element inside another?

<label class='1'>
<div class='2'></div>
</label>


Here is an example of how you can select all divs of exactly this lable parent in js.
I can't think.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
v3shin, 2021-06-11
@b4rbos

let label = document.querySelector('.class1');
let divs = label.querySelectorAll('div');
let divs = label.getElementsByTagName('div'); // или так

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question