mirror of
https://github.com/owncloudarchive/contacts.git
synced 2025-02-14 08:54:19 +01:00
71 lines
2.3 KiB
HTML
71 lines
2.3 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<title>jQuery MultiSelect Plugin Demo</title>
|
||
|
<link rel="stylesheet" type="text/css" href="../jquery.multiselect.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="assets/style.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="assets/prettify.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/ui-lightness/jquery-ui.css" />
|
||
|
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
|
||
|
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
|
||
|
<script type="text/javascript" src="../src/jquery.multiselect.js"></script>
|
||
|
<script type="text/javascript" src="assets/prettify.js"></script>
|
||
|
<script type="text/javascript">
|
||
|
$(function(){
|
||
|
var warning = $(".message");
|
||
|
|
||
|
$("select").multiselect({
|
||
|
header: "Choose only TWO items!",
|
||
|
click: function(e){
|
||
|
|
||
|
if( $(this).multiselect("widget").find("input:checked").length > 2 ){
|
||
|
warning.addClass("error").removeClass("success").html("You can only check two checkboxes!");
|
||
|
return false;
|
||
|
} else {
|
||
|
warning.addClass("success").removeClass("error").html("Check a few boxes.");
|
||
|
}
|
||
|
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
</script>
|
||
|
|
||
|
</head>
|
||
|
<body onload="prettyPrint();">
|
||
|
|
||
|
<h2>Max Checked Test</h2>
|
||
|
<p>Logic to impose a maximum number of checked inputs (two in this demo).</p>
|
||
|
|
||
|
<p class="message success">Check a few boxes.</p>
|
||
|
|
||
|
<form>
|
||
|
<select multiple="multiple">
|
||
|
<option value="option1">Option 1</option>
|
||
|
<option value="option2">Option 2</option>
|
||
|
<option value="option3">Option 3</option>
|
||
|
<option value="option4">Option 4</option>
|
||
|
<option value="option5">Option 5</option>
|
||
|
<option value="option6">Option 6</option>
|
||
|
<option value="option7">Option 7</option>
|
||
|
</select>
|
||
|
</form>
|
||
|
|
||
|
<pre class="prettyprint">
|
||
|
var warning = $(".message");
|
||
|
|
||
|
$("select").multiselect({
|
||
|
header: "Choose only TWO items!",
|
||
|
click: function(e){
|
||
|
if( $(this).multiselect("widget").find("input:checked").length > 2 ){
|
||
|
warning.addClass("error").removeClass("success").html("You can only check two checkboxes!");
|
||
|
return false;
|
||
|
} else {
|
||
|
warning.addClass("success").removeClass("error").html("Check a few boxes.");
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
</pre>
|
||
|
</body>
|
||
|
</html>
|