码迷,mamicode.com
首页 > Web开发 > 详细

jQuery Chosen 使用

时间:2017-05-05 23:11:02      阅读:609      评论:0      收藏:0      [点我收藏+]

标签:.net   否则   arch   doc   http   this   add   问题   upd   

 

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

jQuery Chosen 使用

标签:.net   否则   arch   doc   http   this   add   问题   upd   

原文地址:http://www.cnblogs.com/059212315/p/6815078.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!