重複の可能性:
jQuery にバインドされたイベントを注文する方法
同じ要素に 2 つのイベントをバインドしました。ボタンとしましょう:
<button>Click</button>
<script>
/*First Event*/
$('button').click(function(){
/***Have some piece of code which gets the data that is used for next event***/
});
/*Second Event*/
$('button').click(function(){
/***do some operations with the data that has been fetched from the previous event***/
});
</script>
これで、ボタンでクリックがトリガーされるたびに、2 つのイベントが同時に呼び出されます。そのため、推測どおりに目標を達成することはできません。
最初のイベントがその仕事を終えたら、イベントが呼び出されるように制限できますか....
注:上記のコードは、私の問題を説明するための疑似コードです..