javascript - How to create a searchable drop down list in mvc5? -
i'm trying make current dropdown lists(scaffolded mvc) searchable.
i added script didn't help.
<script type="text/javascript"> $(document).ready(function() { $("select").searchable({ maxlistsize: 100, maxmultimatch: 50, exactmatch: false, wildcards: true, ignorecase: true, latency: 200, warnmultimatch: 'top {0} matches ...', warnnomatch: 'no matches ...', zindex: 'auto' }); });
these dropdown lists
<div class="form-group"> @html.labelfor(model => model.customerid, "customerid", htmlattributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @html.dropdownlist("customerid", null, htmlattributes: new {@class = "form-control" }) @html.validationmessagefor(model => model.customerid, "", new { @class = "text-danger" }) </div> </div> <div class="form-group"> @html.labelfor(model => model.videoid, "videoid", htmlattributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @html.dropdownlist("videoid", null, htmlattributes: new { @class = "form-control" }) @html.validationmessagefor(model => model.videoid, "", new { @class = "text-danger" }) </div> </div>
<div class="form-group"> @html.labelfor(model => model.videoid, "videoid", htmlattributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @html.dropdownlist("videoid", null, htmlattributes: new { @class = "form-control",@class="select2" }) @html.validationmessagefor(model => model.videoid, "", new { @class = "text-danger" }) </div> </div>
<script type="text/javascript"> $(document).ready(function() { $(".select2").select2(); }); </script> <select class="js-example-basic-single"> <option value="al">alabama</option> ... <option value="wy">wyoming</option> </select>
Comments
Post a Comment