それマグで!

知識はカップより、マグでゆっくり頂きます。 takuya_1stのブログ

習慣に早くから配慮した者は、 おそらく人生の実りも大きい。

2013-12-05から1日間の記事一覧

jQuery.eachとArray.forEachで引数の順番が逆でよく間違う

jQuery.each 系のeach list = ["a", "b", "c"] list = $.each( list ,function(i,e){console.log(e)}) a b c e => エレメント i => インデックス JavaScript 1.6 から導入された forEach 系 list = ["a", "b", "c"] list.forEach(function(e,i){ console.log…

cssで先頭から3つをnth-childで取得する:nth-childまとめ

テーブルのtd の先頭から3つを取得するCSS3 nth-childセレクタを作れたら嬉しいデスって話で盛り上がった。 td の先頭から3つに要素を適用したい <table> <tr> <td>1番目 <td>2番目 <td>3番目 <td>4番目 <td>5番目 </tr> </table> 直ぐ思い浮かぶ回答 td:nth-child(1),td:nth-child(2),td:nth-child(…