我已经看过几次问过这个问题,但没有任何东西可以提供帮助。
在我的cshtml文件中,我有以下内容:
<div class="col-lg-8">
@Html.Raw(SelectListHelper.CreateDropDownList("ddlStateCode", Application.DataCache.GetStatesAsLookup()))
</div>
<div class="col-lg-8">
<select class="dropdown" id="ddlContactList"></select>
</div>
Razor下拉列表除了ID之外,还会生成与ddlContactList相同的select标记。
ddlContactList通过AJAX填充。
ddlStateCode在我点击它时会抛出错误,而ddlContactList工作得很好。
我们包括以下脚本:
<script type="text/javascript" src="~/Scripts/jquery-1.10.2.js"></script>
<script type="text/javascript" src="~/Scripts/jquery-ui-1.10.4.min.js"></script>
<script type="text/javascript" src="~/Scripts/bootstrap.js"></script>
<script type="text/javascript" src="~/Scripts/jsrender.min.js"></script>
<script type="text/javascript" src="~/Scripts/globalize.js"></script>
<script type="text/javascript" src="~/Scripts/jquery.easing.min.js"></script>
<script type="text/javascript" src="~/Scripts/ej.widgets.all-latest.min.js"></script>
<script type="text/javascript" src="~/Scripts/App/image-changer.js"></script>
<script type="text/javascript" src="~/Scripts/App/nav.js"></script>
<script type="text/javascript" src="~/Scripts/App/popup.js"></script>
<script type="text/javascript" src="~/Scripts/App/scrollbar.js"></script>
<script type="text/javascript" src="~/Scripts/App/show_hide.js"></script>
<script type="text/javascript" src="~/Scripts/App/jqueryExtensions.js"></script>
<script type="text/javascript" src="~/Scripts/App/helper_functions.js"></script>
<script type="text/javascript" src="~/Scripts/App/ConfirmPopup.js"></script>
<script type="text/javascript" src="~/Scripts/App/global_error_handlers.js"></script>
<script type="text/javascript" src="~/Scripts/jquery.fitvids.js"></script>
<script type="text/javascript" src="~/Scripts/jquery.bxslider.js"></script>
<script type="text/javascript" src="~/Scripts/jquery.easydropdown.js"></script>
问题出现在以下方法的jQuery.easydropdown.js中:
close: function(){
var self = this;
self.$container.removeClass('open'); // error happens here
self.$scrollWrapper.css('height','0px');
self.focusIndex = self.selected.index;
self.query = '';
self.down = false;
},
我不认为jQuery UI文件和jQuery文件版本需要匹配,但我无法找到匹配的版本来尝试。有什么想法吗?
答案 0 :(得分:1)
EasyDropDown在页面加载时为空的选择列表中断。删除javascript文件中的封装函数,并在AJAX调用修复后触发实例化方法。