为什么btnSubmit
点击事件回调函数先触发,然后是动画,而btnSubmit2
回调函数的事件是在动画完成后触发?
$('#btnSubmit').click(function () {
$('#testDiv').hide('slow,', onComplete());
});
var onComplete = function () {
alert('test');
}
$('#btnSubmit2').click(function () {
$('#testDiv').hide('slow', function () {
alert('test');
});
});
HTML
<form id="form1" runat="server">
<div>
<input type="text" id="auto" />
<input type="text" id="auto2" />
</div>
<a id="btnSubmit" href="#">SUBMIT</a>
<a id="btnSubmit2" href="#">SUBMIT 2</a>
<div id="testDiv">Here's some test text</div>
</form>