admin管理员组文章数量:1429791
jQuery show and hide in developer tool and in $(document).ready()
function it is working fine but in regular flow of program its not working in expandTreeNode()
function.
Problem is only in chrome.
$(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;
}
Thanks in advance.
jQuery show and hide in developer tool and in $(document).ready()
function it is working fine but in regular flow of program its not working in expandTreeNode()
function.
Problem is only in chrome.
$(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;
}
Thanks in advance.
Share Improve this question edited May 29, 2014 at 7:21 George 36.8k9 gold badges69 silver badges109 bronze badges asked May 29, 2014 at 7:19 KumarKumar 2751 gold badge4 silver badges12 bronze badges 3-
1
what is
//some code here
? is it some kind of async function? – zzlalani Commented May 29, 2014 at 7:22 -
First, in your
document.ready
, put$('#loading_msg').show();
. If you able to see it, i means it has no problem onshow
– jhyap Commented May 29, 2014 at 7:26 -
1
@Kumar: I was facing the same issue, if in your code
async=false
then make it true. It would work in both - firefox as well as in chrome. – Domain Commented Oct 22, 2015 at 7:28
2 Answers
Reset to default 4Basically .show()
and .hide()
without any parameters would act as synchronous
one, so try
$('#loading_msg').show('slow');
$('#loading_msg').hide('slow');
It may be that your JavaScript code is executed before #loading_msg object has been loaded to DOM. If you declare this function in your html head section try to move it to the bottom of the page or just move the function between $(document).ready() function.
本文标签: javascriptjquery hideshow not working in chromeStack Overflow
版权声明:本文标题:javascript - jquery hide, show not working in chrome - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745541086a2662497.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论