我今天找了个下拉搜索框,差点把我小命整没了就是这个http://www.jq22.com/jquery-info7063地址,我整下来不会用啊,没有onclick和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
);
}
}
然后下面取值也没法兼听onchange 事件,我用的是
$(".all_hotel1").change(function(){ var checkValue = $(".all_hotel1").find("option:selected").val(); //获取Select选择的Value. $("input[name='search_data2']").val(checkValue); })这种方法取的值,哎,好好学学js啊