showing results for - "how to use get element without document"
Henry
28 Jan 2020
1// You can use querySelector ->
2
3//first get your element with query or getelement
4let element = document.getElementById('id');
5let element = document.querySelector('#id');
6
7//you can use query on this element to only get element from this element
8
9//with id
10let text1 = element.querySelector('#text1');
11
12//with class
13let text2 = element.querySelector('.text2');
14
15//other way
16let span = element.querySelector('span');
17
18//querySelector will only get the first element found, if you want them all you
19//have to use querySelectorAll