-
Notifications
You must be signed in to change notification settings - Fork 0
/
form.html
47 lines (36 loc) · 878 Bytes
/
form.html
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
36
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div id="sb">
asdasda
<p class="a">1</p>
<p class="a" id="target" onclick="aa">2</p>
<p class="a">3</p>
<p class="a"> =3</p>
<p id="q" class="a">4</p></div>
</body>
</html>
<script>
function aa() {
console.log(12);
}
let findIndex = Array.from(sb.childNodes).findIndex((value,index)=>{
return value === q;
});
var ary=[]
/*Array.from(sb.childNodes).forEach(function (item,index) {
console.log(item);
if( item.nodeType == 3 || item.nodeType == 1 ){
if(item.nodeType == 3 && typeof(item.nodeValue) !== 'string'){
console.log(12121);
return
}
ary.push(item)
}
})*/
console.log(findIndex);
</script>