0
ASP.NET MVC應用程序。jQuery單擊事件處理程序在IE中不起作用,儘管事件處理程序中的函數可以正常運行
只有IE瀏覽器有問題。
考慮這2個功能:
function refreshParameters() {
doRefresh('#loading-production-parameters', '#partial-rows-parameters', '@VirtualPathUtility.ToAbsolute("~/home/ProductionParameters")');
}
//
//
//
function refreshTotals() {
doRefresh('#loading-production-totals', '#partial-rows-totals', '@VirtualPathUtility.ToAbsolute("~/home/ProductionTotals")');
}
腳本和事件處理程序的開頭:
$(function() {
//
//Init
//Initial Tasks
//
refreshParameters();
refreshTotals();
//
// Events
//
$('#yla-debug').click(function (e) {
refreshParameters();
refreshTotals();
});
奇怪的是,refreshParameters和refreshTotals運行在頁面加載時。
但在點擊事件處理程序,他們不。
,如果我在事件處理程序提出警告它激發起來的螢火ok.Also控制檯顯示沒有錯誤
任何想法?
P.S:使用該事件的元素的html標記。
<div id="yla-debug" class="panel panel-default">
<div class="panel-heading clearfix">
<h3 class="panel-title pull-left">Daily Production Data for <span style="font-weight: bold;">@ViewBag.SiteName</span> </h3>
<span style="font-weight: normal; background-color: #000080;" class="badge pull-left">(Autoupdate every 30 min.)</span>
<div class="pull-right" id="loading-production-parameters">
<span>Refreshing</span>
<img src="~/Content/ajax-loader-bar1.gif" />
</div>
</div>
<div class="panel-body">
<table id="partial-rows-parameters" class="table table-striped table-hover">
</table>
</div>
<div class="panel-footer">
<span>Last Refresh: </span>
<span id="last_refresh_parameters"></span>
</div>
</div>
附加信息#1:
即使我將選擇一個更通用的一個它不工作。 $( '體),$(' IMG')....
附加信息#2:
不從事件中調用,但在啓動時運行時運行的doRefresh方法:
function doRefresh(what, dataContainer, action) {
$(what).show();
$.ajax({
url: action,
dataType: 'html',
success: function (data) {
$(dataContainer).html(data);
$(what).hide();
}
});
嘗試提醒$('#yla-debug')。length以確保選擇器正在獲取所需的dom元素。也嘗試附加一個調試器內的點擊功能,以檢查控制是否真的在那裏結束.. –
這怎麼發生,我的意思是funcitons在開始時運行正常..並且點擊處理程序與警報一起工作... – e4rthdog