-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathjquery-selectbox-example3.html
53 lines (47 loc) · 1.45 KB
/
jquery-selectbox-example3.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
<!doctype html>
<html>
<head>
<title>Custom SelectBox</title>
<link rel="stylesheet" href="css/jquery.jscrollpane.css" />
<link rel="stylesheet" href="css/customSelectBox.css" />
<!-- example.css is throwaway code for demoing -->
<link rel="stylesheet" href="css/example.css" />
</head>
<body class="noJS" id="example-1">
<script>
var bodyTag = document.getElementsByTagName("body")[0];
bodyTag.className = bodyTag.className.replace("noJS", "hasJS");
</script>
<h2>Link Select</h2>
<form method="GET" class="module-link-select" target="_blank">
<select class="custom">
<option value="">Select a link</option>
<option value="http://www.google.com">Google</option>
<option value="http://www.yahoo.com">Yahoo</option>
<option value="http://www.bing.com">Bing</option>
</select>
</form>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script src="js/jScrollPane.js"></script>
<script src="js/jquery.mousewheel.js"></script>
<script src="js/SelectBox.js"></script>
<script>
$(function() {
$(".module-link-select").each(function() {
var $form = $(this);
var sb = new SelectBox({
selectbox: $form.find("select"),
height: 150,
width: 200,
changeCallback: function(val) {
if( val !== "" ) {
$form.attr("action", val);
$form.submit();
}
}
});
});
});
</script>
</body>
</html>