スキップしてメイン コンテンツに移動

jQuery.each()ループから抜けるには?

jQuery.each()ループから抜けるには?

jQuery、javaScriptのループから抜けるには、

breakがよく、使われるが、どうやらjQueryのeach()ループから抜けるには、

returnでやらないといけない。

jQueryの仕様では、下記のように書いてある。
「
 We can break the $.each() loop at a particular iteration by making the callback function return false.
 Returning non-false is the same as a continue statement in a for loop;
 it will skip immediately to the next iteration.
」

なので、returnを使いましょう!

コメント

このブログの人気の投稿

gitよく使うコマンド集

よく使うgitのコマンド集をまとめてみた。 1.ローカルリポジトリの登録  #git init 2.gitの状態を確認  #git status 3.gitのファイルを追加  #git add . 4.ローカルのマスタにコミットする  #git commit -m "体温管理アプリの初期化" 5.リモートリポジトリを登録する  #git remote add origin https://github.com/ユーザーID/リポジトリ名  例)git remote add origin https://github.com/githubkyo/taionkanri 6. リモートリポジトリの変更履歴の取得 git fetch origin master 7.差分のあるファイル名を表示 > git diff --name-status ローカルブランチ名 origin/リモートブランチ名 【例】 > git diff --name-status master origin/master 8.リモートのファイルのみをローカルに反映する。 git checkout origin/master --src/Eccube/Resource/template/default/default_frame.twig 9.別ブランチをマスタへマージする git checkout master git merge other_branch 以上で、随時更新していく予定。

sendmailをgmail経由で送信する設定

 1.sendmail.iniで下記の設定を行う。 ------------------------------- smtp_server=smtp.gmail.com smtp_port=465 auth_username=youraccount@gmail.com auth_password=youraccountpassword force_sender=youraccount@gmail.com ------------------------------- 2.gmailでの設定 https://myaccount.google.com/securityへアクセスし、 安全性の低いアプリのアクセス 「オフ―」から「オン」に変える。 3.php.iniでsendmail_pathを設定する。 [mail function] ; For Win32 only. ; http://php.net/smtp ;SMTP = localhost ; http://php.net/smtp-port smtp_port = 465 ; For Win32 only. ; http://php.net/sendmail-from ;sendmail_from ="admin@wampserver.invalid" ; For Unix only.  You may supply arguments as well (default: "sendmail -t -i"). ; http://php.net/sendmail-path sendmail_path = "sendmailフォルダーのパス\sendmail.exe -t" 4.Apacheを再起動すれば、sendmailが使えるようになる。 以上です。