jQuery Chosen 使用


 

1.  jQuery Chosen 選擇框下拉值重置;

 //重置
$("#easySelBrands").val("默認值").trigger("chosen:updated");

        

  賦值為默認值后要用trigger("chosen:updated")更新,否則無效;

 

 

2. 多個select在一起的問題

在chosen.jquery.js中找到此方法:

1 Chosen.prototype.activate_field
2  = function()
3  {
4     this.container.addClass("chzn-container-active");
5     this.active_field
6  = true;      
7     this.search_field.val(this.search_field.val());
8     return this.search_field.focus();
9 };

將此方法改為:

1  Chosen.prototype.activate_field = function() {
2       this.container.addClass("chosen-container-active");
3       this.active_field = true;
4       this.search_field.val(this.search_field.val());
5       var zindex = 1010;
6       this.container.css('z-index', '1010')
7       $('.chosen-container').not(this.container).css('z-index', --zindex);
8       return this.search_field.focus();
9     };

 

 

參考鏈接

https://github.com/amazeui/chosen/blob/master/docs/options.md

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM