-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.html
More file actions
58 lines (50 loc) · 1.69 KB
/
Copy pathexample.html
File metadata and controls
58 lines (50 loc) · 1.69 KB
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
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html lang="en>">
<head>
<title>News</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<div class="container"></div>
<div class="news">
<ul class="list">
<li class="row first">Home</li>
<li class="row second">Politics</li>
<li>Bussiness</li>
<li class="row fourth">World</li>
</ul>
<ul class="list">
<li>Science</li>
<li class="row second">Arts</li>
<li>Tech</li>
<li class="row fourth">Sport</li>
</ul>
<button id="btn" style="padding:8px 12px;cursor:pointer">Click Me</button>
</div>
</body>
<script type="module">
import {default as el} from './el.js';
// create
const newDiv = el.create('div')
.addAttr({'role': 'test', 'dest': 'target'})
.addClass('green')
.html('<h2>NEWS</h2>')
.css({background: '#999', color: '#fff', display: 'flex', 'justify-content': 'center'});
el.q('.container').append(newDiv);
// modify
const li = el.q('.news')
.find('ul').css({'list-style': 'none', 'padding-left': 0})
.find('li').css({padding: '8px 10px 8px'})
.siblings('.second').css('background', '#fdff77').css('color', '#118ca7');
const filteredCollection = li.filter(function(element, index) {
if (index === 0) {
return true;
}
});
// assign event
el.q('.news').on('click', '#btn' , (e) => alert('Clicked'));
console.log('Filtered ' + filteredCollection.length() + ' element(s)');
</script>
</html>