LoginSignup
2
3

More than 5 years have passed since last update.

JSで時間をおいてから次の処理を行いたいとき

Posted at

入力した文字のブラウザ反映を遅らせたいときなどにjavascriptでどのようにしたらいいかというときのJS初心者によるメモです。

window.setTimeout( 関数名, 500 );  //set delay

単位時間[ms]で待ち時間を設定し、上では500[ms]としています。
関数が引数を持たない場合上のように書けますが、引数を持つ場合以下のように書きます。

window.setTimeout( function() { 関数名(x) }, 500 );
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3