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

回答編集履歴

1

情報の追加。

2017/01/20 17:18

投稿

kei344
kei344

スコア69638

answer CHANGED
@@ -9,4 +9,21 @@
9
9
  $( this ).prop( 'src', 'https://placehold.jp/24/99cc99/339933/150x50.png?text='+ ( i + 1 ) + '.jpg' );
10
10
  } );
11
11
  } );
12
- ```**動くサンプル:**[https://jsfiddle.net/s6be2LL6/](https://jsfiddle.net/s6be2LL6/)
12
+ ```**動くサンプル:**[https://jsfiddle.net/s6be2LL6/](https://jsfiddle.net/s6be2LL6/)
13
+
14
+ ---
15
+
16
+ **追記:**
17
+
18
+ ```JavaScript
19
+ $( function() {
20
+ var html = '', img_count = 10, i = 0;
21
+ while( i < img_count ) {
22
+ ++i;
23
+ html += '<a href="https://placehold.jp/24/99cc99/339933/350x150.png?text='+ i + '.jpg">';
24
+ html += '<img src="https://placehold.jp/24/cc9999/993333/150x50.png?text='+ i + '.jpg">';
25
+ html += '</a>';
26
+ }
27
+ $( 'body' ).html( html );
28
+ } );
29
+ ```**動くサンプル:**[https://jsfiddle.net/s6be2LL6/2/](https://jsfiddle.net/s6be2LL6/2/)