2013-10-08 24 views
0

我想重新加載一個jqgrid根據圖像的標題。如果標題是liveON,它應該進入內部,但事實並非如此。問題是什麼?我需要用jquery獲得標題參數嗎?提前致謝。檢查IMG標題觸發一個jqgrid

function reloadJson(){ 
    alert("Go!"); 
    if (document.getElementById("auto_reload").title == "liveON") 
    {  
     $('#list').trigger("reloadGrid"); 
    }  
} 
+0

你爲什麼不使用所有的jQuery?例如,「$('#auto_reload')。attr('title')」。我會做的唯一的其他小建議是確保ID是唯一的和/或檢查標題和/或ID中的拼寫錯誤。 – dwaddell

回答

0

使用jQuery:

if ($("#auto_reload").attr("title") == "liveON") 
{  
    $('#list').trigger("reloadGrid"); 
} 
+0

正常工作,謝謝! –