I cannot initially hide(); my span tag
I have a loader animated gif that I want to hide and show during my ajax request.
this is my loader html code.
<span id="loader"><img src="images/icons/ajax-loader.gif" alt="loader" /></span>
I want to initially hide it with this
<script type="text/javascript">
$(document).ready(function() {
$('#loader').hide()
});
</script>
however it still shows up until until my ajax 开发者_Go百科function is actually run and then hides it. but I want to hide it at startup.
It isn't being hidden until your document is loaded and "ready". To prevent it from showing up at all, include this CSS before your <body>
:
<style>
#loader { display: none; }
</style>
Add the style display:none;
to the span in the markup.
<span id="loader" style="display:none;">
<img src="images/icons/ajax-loader.gif" alt="loader" />
</span>
<span id="loader" style="display: none">...</span>
did u use asp.net? maybe progress panel trigger it
$('#loader') is just a content inside
try
$('#loader').parent().hide()
<script type="text/javascript">
$(document).ready(function() {
$('#loader').css("display","none");
});
</script>
精彩评论