teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

追記

2016/07/19 09:16

投稿

shi_ue
shi_ue

スコア4437

answer CHANGED
@@ -3,4 +3,11 @@
3
3
  $(".form-list").each(function(){
4
4
  $(this).children("li:first").children("input").prop("checked",true);
5
5
  });
6
- ```かな?
6
+ ```かな?
7
+
8
+ 追記
9
+ ---
10
+ eachなしで。
11
+ ```javascript
12
+ $(".form-list").children("li:first-child").children("input").prop("checked",true);
13
+ ```

1

変更

2016/07/19 09:15

投稿

shi_ue
shi_ue

スコア4437

answer CHANGED
@@ -1,5 +1,6 @@
1
+ 先ほどの取り消し。
1
2
  ```javascript
2
- $(".form-list li:first input").each(function(){
3
+ $(".form-list").each(function(){
3
- $(this).prop('checked',true);
4
+ $(this).children("li:first").children("input").prop("checked",true);
4
5
  });
5
6
  ```かな?