Chosen plugin http://www.jb51.net/jiaoben/38027.html
Copy codeThe Code is as follows:
<Script src = "https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type = "text/javascript"> </script>
<Script src = "chosen/chosen. jquery. js" type = "text/javascript"> </script>
Apply JS files
Copy codeThe Code is as follows:
<Select class = "chzn-select" data-placeholder = "Choose a Country" style = "width: 350px;" tabindex = "1">
<Option value = ""> </option>
<Option value = "United States"> United States </option>
<Option value = "United Kingdom"> United Kingdom </option>
<Option value = "Afghanistan"> Afghanistan </option>
<Option value = "Albania"> Albania </option>
</Select>
Class sets this to chzn-select
Initialization: $ (". chzn-select"). chosen ();
Note the following when performing select operations: First Delete the External Applied layer and then add $ (". chzn-select"). chosen ();
Copy codeThe Code is as follows:
Var selectObj = $ ("# slectplat ");
SelectObj. parent (). children (). remove ('div ');
SelectObj. removeClass ();
$ ("# Slectplat"). val (_ plat );
SelectObj. addClass ("chzn-select ");
SelectObj. chosen ();