-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhome.html
65 lines (65 loc) · 2.22 KB
/
home.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<html>
<head>
<title>J Query</title>
<script src="jquery-3.4.1.min.js"></script>
<script>
$(document).ready(function() {
$('#redbtn').mouseover(function() {
$('body').css('background-color','red');
});
$('#greenbtn').mouseover(function() {
$('body').css('background-color','green');
});
$('#bluebtn').mouseover(function() {
$('body').css('background-color','blue');
});
$('#extract-text').click(function() {
var text = "";
for (const iterator of $('#itemlist')) {
text += iterator.innerText;
}
console.log("The extracted text from the list is : " + text);
});
$('#search').keyup(function() {
var text = $('#search').val();
$('#towns').find('li').each(function() {
var n = $(this)[0].innerText.search(text);
//console.log($(this)[0].innerText + n);
if(n>=0 && text.length>0)
{
$(this).css('font-weight', 'bolder');
}
else
{
$(this).css('font-weight', 'normal');
}
})
})
});
</script>
</head>
<body>
<button id="redbtn">Red</button>
<button id="greenbtn">Green</button>
<button id="bluebtn">Blue</button>
<br>
<ul id="itemlist">
<li>Computer</li>
<li>Books</li>
<li>Telephones</li>
<li>Mobiles</li>
<li>Laptops</li>
</ul>
<button id="extract-text">Extract Text</button>
<br>
<br>
<ul id="towns">
<li>Chennai</li>
<li>Mumbai</li>
<li>Bangalore</li>
<li>Mangalore</li>
<li>Calicut</li>
</ul>
<input type="text" name="search" id="search">
</body>
</html>