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.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745541087a4632131.html
评论列表(0条)