简体   繁体   English

选择没有正确选择下拉列表的样式

[英]Chosen is not styling my select drop-down properly

Here is my code: 这是我的代码:

<link href="Content/chosen.css" rel="stylesheet" type="text/css"/>

<div>
<select id="chzn-select" data-placeholder="Select an option...">
    <option value=""></option>
    <option value="Option1">Option 1</option>
    <option value="Option2">Option 2</option>
</select>
</div>

<script type="text/javascript" src="../Scripts/jquery-1.8.2.js"></script>
<script type="text/javascript" src="../Scripts/chosen.jquery.js"></script>
<script type="text/javascript" src="../Scripts/chosen.jquery.min.js"></script>
<script type="text/javascript">

$("#chzn-select").chosen();

</script>

This is the result: 这是结果:

选择造型

I can "select" Option 1 or Option 2, and they will appear where the "Select an option..." label is. 我可以“选择”选项1或选项2,它们将出现在“选择选项...”标签的位置。

Please try below code, it working for me. 请尝试以下代码,它适合我。

<link href="http://harvesthq.github.com/chosen/chosen/chosen.css" rel="stylesheet" type="text/css"/>

<div>
 <select id="chzn-select" data-placeholder="Select an option...">
  <option value=""></option>
  <option value="Option1">Option 1</option>
  <option value="Option2">Option 2</option>
 </select>
</div>

<script type="text/javascript">
    $("#chzn-select").chosen();
</script>

Here is the JSFIddle (working demo of your code) 这是JSFIddle (代码的工作演示)

chosen.jquery.js was included twice in your code. selected.jquery.js在您的代码中包含两次。 Also i think chosse.css path need to be corrected in your code as per your directory structure. 另外我认为chosse.css路径需要根据你的目录结构在你的代码中得到纠正。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM