jquery Chosen使用

來源:互聯網
上載者:User

標籤:jquery chosen使用

1,首先去http://harvesthq.github.io/chosen/下載外掛程式。
2,在網頁中加入下面的檔案。
<link rel="stylesheet" href="/css/chosen.css" />
<script type="text/javascript" src="/js/jquery.form.js"></script>
<script type="text/javascript" src="/js/chosen.jquery.js"></script>
3,在頁面中加入以下js:其中"emp_input_init"只是起到讓jquery外掛程式擷取select元素的作用。


jQuery(‘.emp_input_init‘).chosen();


4,在頁面中使用select標籤的地方加入class,即可如下:
 <select class="select_input_init"  id="emp_id"  name="empId">
         <c:forEach items="${empList}" var="emp">
                <option url =‘${emp.url}‘ value=‘${emp.id}‘> ${emp.name} </option>
        </c:forEach>
</select>


注意:
如果有兩個select標籤進行級聯 則需要在第二個select的事件中寫入下面的js,否則級聯失效.
jQuery(‘.emp_input_init‘).trigger("liszt:updated");




參考:http://blog.csdn.net/iamduoluo/article/details/11519909

jquery Chosen使用

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.