This question may be asked before. But I cant find the error. Here this is from the video tutorial of new boston.
$(document).ready(function(){
$('#btn').toggle(function(){
$('#msg').html('yes');
},function(){
$('#msg').html('No');
});
});
The video showing that when click first the div text is yes and next time it show no But when I try, when the page loads, the button fadeout and div show no. Why? There may be other methods to achieve this functionality. But why this dont work. He showing the syntax of toggle as
$('#btn').toggle(function(){code},function{code});
See Question&Answers more detail:os