其他还好,在iphone手机使用iphone 自带输入法进行输入,没有效果(iphone安装的其他输入法可以用),是不是iphone自带输入法 判断输入完成与其他的输入法不同?
回复show: function() {
this.input.val(''); /*每次点击清空搜索内容*/
this.items.find('.searchable-select-item').removeClass('searchable-select-hide'); /*让元数据显示*/
this.down.removeClass('searchable-select-hide');
this.input.focus();
this.status = 'show';
this.setPriviousAndNextVisibility();
},在show函数中添加注释的两句就是清空input和回复数据
多个这种下拉菜单放一起,会遮挡的问题,怎么解决??????
刚刚解决了,加2句,看注释处;
show: function() {
this.dropdown.removeClass('searchable-select-hide');
this.input.focus();
this.status = 'show';
this.setPriviousAndNextVisibility();
this.dropdown.css('z-index', 100); //打开下拉列表时调高z-index层级
}, hide: function() {
if (!(this.status === 'show')) return;
if (this.items.find(':not(.searchable-select-hide)').length === 0) this.input.val('');
this.dropdown.addClass('searchable-select-hide');
this.searchableElement.trigger('focus');
this.status = 'hide';
this.dropdown.css('z-index', 1); //关闭下拉列表时恢复z-index层级
},
js克隆出来的新select,点击没有效果。求大神解答,把下边的源码click改为live不可用,请问该如何修改?
this.searchableElement.click(function(event) {
// event.stopPropagation();
_this.show();
}).on('keydown', function(event) {
if (event.which === 13 || event.which === 40 || event.which == 38) {
event.preventDefault();
_this.show();
}
});
不支持change事件啊,想二级联动用不了了
在css文件中
搜索.searchable-select-dropdown字段
增加z-index:1;试试
.searchable-select-dropdown {
position: absolute;
z-index:1;
background-color: #fff;
border: 1px solid #ccc;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
padding: 4px;
border-top: none;
top: 28px;
left: 0;
right: 0;
}
ie11设置浏览器兼容性后,上一个下拉框列出的内容会被下一个下拉框遮挡,这个怎么解决?
//退格稍改了一下 这个插件很给力的
filter: function() {
var text = this.input.val();
if (text.replace(/\s/g, "").length > 0) {
this.items.find('.searchable-select-item').addClass('searchable-select-hide');
this.items.find('.searchable-select-item:searchableSelectContains(' + text + ')').removeClass('searchable-select-hide');
if (this.currentSelectedItem.hasClass('searchable-select-hide') && this.items.find('.searchable-select-item:not(.searchable-select-hide)').length > 0) {
this.hoverFirstNotHideItem();
}
this.setPriviousAndNextVisibility();
} else {
$(".searchable-select-items").html("");
this.buildItems();
}
}
可以在selectItem 中设置完select的值之后显式触发change,即可监听onchange
selectItem: function(item){
if(this.hasCurrentSelectedItem())
this.currentSelectedItem.removeClass('selected');
this.currentSelectedItem = item;
item.addClass('selected');
this.hoverItem(item);
this.holder.text(item.text());
var value = item.data('value');
this.holder.data('value', value);
this.element.val(value);
this.element.change();//触发onchange
if(this.options.afterSelectItem){
this.options.afterSelectItem.apply(this);
}
}