29 lines
667 B
HTML
29 lines
667 B
HTML
|
<html>
|
||
|
<head>
|
||
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
|
||
|
<link href="select2.css" rel="stylesheet"/>
|
||
|
<script type="text/javascript" src="select2.js"></script>
|
||
|
</head>
|
||
|
<body>
|
||
|
<select id="s1">
|
||
|
<option value="A"></option>
|
||
|
<option value="B"></option>
|
||
|
</select>
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
$(document).ready(function () {
|
||
|
$("#s1").select2({}).on("change", function () {
|
||
|
alert("Changed caused by val()");
|
||
|
}).select2("val", "A");
|
||
|
|
||
|
// This should not trigger a change
|
||
|
$("#s1").select2("val", "B", false);
|
||
|
});
|
||
|
|
||
|
</script>
|
||
|
|
||
|
|
||
|
</body>
|
||
|
|
||
|
</html>
|