配列を関数に渡したいです(正しい軌道に乗っているかどうか教えてもらえますか?)
次に、関数で配列内の値をループ処理し、それぞれを HTML の次の LI 要素に追加します。
これは私がこれまでに持っているもので、ユーザーが渡したい URL 値をコーディングします。
var arrValues = ['http://imgur.com/gallery/L4CmrUt', 'http://imgur.com/gallery/VQEsGHz'];
calculate_image(arrValues);
function calculate_image(arrValues) {
// Loop over each value in the array.
var jList = $('.thumb').find('href');
$.each(arrValues, function(intIndex, objValue) {
// Create a new LI HTML element out of the
// current value (in the iteration) and then
// add this value to the list.
jList.append($(+ objValue +));
});
}
}
HTML
<li>
<a class="thumb" href="" title="Title #13"><img src="" alt="Title #13" /></a>
<div class="caption">
<div class="download">
<a href="">Download Original</a>
</div>
<div class="image-title">Title #13</div>
<div class="image-desc">Description</div>
</div>
</li>