All Components

MultiSelect / Basic usage

Invite Attendees

HTML5/JavaScript 源码

<!DOCTYPE html>
<html>
 <head> 
  <title>Basic usage</title> 
  <meta charset="utf-8"> 
  <link href="../content/shared/styles/examples-offline.css" rel="stylesheet"> 
  <link href="../../styles/kendo.common.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.rtl.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.default.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.dataviz.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.dataviz.default.min.css" rel="stylesheet"> 
  <script src="../../js/jquery.min.js"></script> 
  <script src="../../js/kendo.all.min.js"></script> 
  <script src="../content/shared/js/console.js"></script> 
  <script>
        
    </script> 
 </head> 
 <body> 
  <a class="offline-button" href="../index.html">Back</a> 
  <div id="example" role="application"> 
   <div class="demo-section k-content"> 
    <h2>Invite Attendees</h2> 
    <label for="required">Required</label> 
    <select id="required" multiple data-placeholder="Select attendees..."> <option>Steven White</option> <option>Nancy King</option> <option>Nancy Davolio</option> <option>Robert Davolio</option> <option>Michael Leverling</option> <option>Andrew Callahan</option> <option>Michael Suyama</option> <option selected>Anne King</option> <option>Laura Peacock</option> <option>Robert Fuller</option> <option>Janet White</option> <option>Nancy Leverling</option> <option>Robert Buchanan</option> <option>Margaret Buchanan</option> <option selected>Andrew Fuller</option> <option>Anne Davolio</option> <option>Andrew Suyama</option> <option>Nige Buchanan</option> <option>Laura Fuller</option> </select> 
    <label for="optional">Optional</label> 
    <select id="optional" multiple data-placeholder="Select attendees..."> <option>Steven White</option> <option>Nancy King</option> <option>Nancy Davolio</option> <option>Robert Davolio</option> <option>Michael Leverling</option> <option>Andrew Callahan</option> <option>Michael Suyama</option> <option>Anne King</option> <option>Laura Peacock</option> <option>Robert Fuller</option> <option>Janet White</option> <option>Nancy Leverling</option> <option>Robert Buchanan</option> <option>Margaret Buchanan</option> <option>Andrew Fuller</option> <option>Anne Davolio</option> <option>Andrew Suyama</option> <option>Nige Buchanan</option> <option>Laura Fuller</option> </select> 
    <button class="k-button" id="get">Send Invitation</button> 
   </div> 
   <style>
        .demo-section label {
            display: block;
            margin: 15px 0 5px 0;
        }
        #get {
            float: right;
            margin: 25px auto 0;
        }
    </style> 
   <script>
        $(document).ready(function() {
            // create MultiSelect from select HTML element
            var required = $("#required").kendoMultiSelect().data("kendoMultiSelect");
            var optional = $("#optional").kendoMultiSelect({
                autoClose: false
            }).data("kendoMultiSelect");

            $("#get").click(function() {
                alert("Attendees:\n\nRequired: " + required.value() + "\nOptional: " + optional.value());
            });
        });
    </script> 
  </div>   
 </body>
</html>