forked from codingmarket07/Custom-Select-Box
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
69 lines (64 loc) · 1.59 KB
/
index.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
66
67
68
69
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Custom Select Box</title>
<link rel="stylesheet" href="styles.css">
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script>
$(document).ready(function(){
$(".default_option").click(function(){
$(this).parent().toggleClass("active");
})
$(".select_ul li").click(function(){
var currentele = $(this).html();
$(".default_option li").html(currentele);
$(this).parents(".select_wrap").removeClass("active");
})
});
</script>
</head>
<body>
<div class="wrapper">
<div class="title">
Custom Select Box
</div>
<div class="select_wrap">
<ul class="default_option">
<li>
<div class="option pizza">
<div class="icon"></div>
<p>Pizzas</p>
</div>
</li>
</ul>
<ul class="select_ul">
<li>
<div class="option pizza">
<div class="icon"></div>
<p>Pizzas</p>
</div>
</li>
<li>
<div class="option burger">
<div class="icon"></div>
<p>Burget</p>
</div>
</li>
<li>
<div class="option ice">
<div class="icon"></div>
<p>Ice Cream</p>
</div>
</li>
<li>
<div class="option fries">
<div class="icon"></div>
<p>Fried Potatoes</p>
</div>
</li>
</ul>
</div>
</div>
</body>
</html>