Ajax - why do I need to click twice?
Hi,
When I add the effect .slideToggle to my code, I need to click the button twice to load the content via Ajax.
Why? And how can I combine .load() and .slideToggle() properly?
- <body>
<div class="centerDiv">
<input type="button" value="Click me to load" id="myBtn">
<div id="content"></div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$("#myBtn").click(function(){
$("#content").load("anotherPage.html").slideToggle();
});
});//End of document ready
</script>
</body>
The Code in action
Thanks