【发布时间】:2011-09-14 14:13:43
【问题描述】:
我有一个小图像列表,点击每个小图像时,它们应该显示在 div 中(想法是让它们变大)
我使用了追加函数jQuery,但它不起作用
这里是 jQuery 代码:
$(function() {
$('.selectable a img').click(function() {
var img=$(this).attr('src');
alert(img);// this is what i get data/100.jpg but it does not show up in div
('#div1').append('img');
});
});
部分 CSS 代码:
<ul>
<?php foreach ($cakeTypeService->getByTypeAndSubtype('stage', 'ROSE') as $cake) { ?>
<li class="selectable" id="cakeType-<?= $cake->id ?>">
<a href="?cakeType=<?php echo ($cake->id); ?>" title="Selecteer">
<?php if ($cake == $order->cakeType){?><span class="checked"></span><?php } ?>
<img src="data/<? echo $cake->id ?>.jpg" alt="" width="50" height="50" /></a>
</li>
<?php } ?>
</ul>
【问题讨论】: