-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDOM.js
More file actions
35 lines (28 loc) · 787 Bytes
/
Copy pathDOM.js
File metadata and controls
35 lines (28 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
console.log("new tutorial for DOM");
let a = document ;
// a = document.all;
// a = document.body;
// a = document.forms; //multiple forms : document.forms[0]
// a = document.links;
// Array.from(a).forEach(function(element) {
// console.log(element)
// })
a = document.links;
link = 'javascript'
// console.log(a);
//Below is the code to determine the links in the webpage having the content 'Javascript'
Array.from(a).forEach(function(element) {
if (element.href.includes(link))
{
console.log(element);
}})
console.log(typeof Array.from(a))
console.log("logic 2")
//Just the change in syntax of the loop
for (let i=0;i<a.length;i++){
if (a[i].text.includes(link))
{
console.log(i);
console.log(a[i]);
}
}