环境: jQuery UI 1.12.1 jQuery Chosen插件v1.6.2 浏览器:Chrome v53.0.2785.143,IE 9,edge
下拉列表的html代码如下所示;
<div class="dv-prizemoney-search search-item-margin">
<span class="search-title">Prize Money</span>
<select size="1" name="ctl00$MainContent$lstPrizeMoney" multiple="multiple" id="ctl00_MainContent_lstPrizeMoney" tabindex="4" data-placeholder="Choose a Prize Money" class="lst-prizemoney chosen-select" style="width:100%;">
<option selected="selected" value="0">All Prize Monies</option>
<option value="<= $5,000"><= $5,000</option>
<option value="$5,000 - 10,000">$5,000 - 10,000</option>
<option value="$10,000 - 20,000">$10,000 - 20,000</option>
<option value="$20,000 - 30,000">$20,000 - 30,000</option>
<option value="$30,000 - 50,000">$30,000 - 50,000</option>
<option value="$50,000 - 75,000">$50,000 - 75,000</option>
<option value="$75,000 - 100,000">$75,000 - 100,000</option>
<option value="> $100,000">> $100,000</option>
</select>
</div>
日期选择器的输入框如下所示;
<div class="hdn-to-date"><input type="hidden" name="ctl00$MainContent$txtToDate" id="ctl00_MainContent_txtToDate" value="16/01/2017" /></div>
jQuery for datepicker:
$("#ToDate").datepicker({
dateFormat: 'dd/mm/yy',
changeMonth: true,
changeYear: true,
yearRange: "2016:2020",
minDate: startDateFrom,
onSelect: function(dateText) {`enter code here`
$('.hdn-to-date').find(':input').val(dateText)
}
});
选择设置:
var config = {
'.chosen-select': {},
'.chosen-select-deselect': {
allow_single_deselect: true
},
'.chosen-select-no-single': {
disable_search_threshold: 10
},
'.chosen-select-no-results': {
no_results_text: 'No results found!'
},
'.chosen-select-width': {
width: "95%"
}
}
for (var selector in config) {
$(selector).chosen(config[selector]);
}
在Jquery UI插件中更改年份事件(行号736):
_selectMonthYear: function(id, select, period) {
var target = $(id),
inst = this._getInst(target[0]);
inst["selected" + (period === "M" ? "Month" : "Year")] =
inst["draw" + (period === "M" ? "Month" : "Year")] =
parseInt(select.options[select.selectedIndex].value, 10);
this._notifyChange(inst);
this._adjustDate(target);
},
从日期选择器更改年份时,此事件会收到“select”参数的错误元素(我收到了选择的选择对象)。
我想如果有人可以协助解决这个问题。