[英]jquery hide, show not working in chrome
jQuery在開發人員工具和$(document).ready()
函數中顯示和隱藏,效果很好,但是在程序的常規流程中, expandTreeNode()
函數不起作用。
問題僅在於鉻合金。
$(document).ready(function(){
$('#loading_msg').hide();
});
//not working
function expandTreeNode(item) {
if (item.p.postData.nodeid == undefined)
return true;
$('#loading_msg').show();
//some code here
$('#loading_msg').hide();
return false;
}
提前致謝。
基本上.show()
和.hide()
不帶任何參數將作為synchronous
一個,所以盡量
$('#loading_msg').show('slow');
$('#loading_msg').hide('slow');
您的JavaScript代碼可能是在#loading_msg對象已加載到DOM之前執行的。 如果您在html頭部分中聲明了此函數,請嘗試將其移至頁面底部,或者僅在$(document).ready()函數之間移動該函數。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.