开发者

jQuery - image SRC

Am I doing something wrong? #contactImg is not getting the src pass开发者_如何学Goed

var clickedImage = $('img.img_rightThumb').attr("src");
$('#contactImg').attr('src', clickedImage);

OK the selector I guess is bad...but I don't see how...

<? if ($this->profile['has_user_image']) { ?>
<img src="/images/users/<?= $this->profile['user_image'] ?>" width="114" class="img_rightThumb">
<? } else { ?>
<img src="/images/avatar.png" width="114" height="86" class="img_rightThumb">
<? } ?>


Seems like it's not finding the image. Try doing this to verify:

alert($('img.img_rightThumb').length);

If 0, the problem is the selector. Post some HTML and we can help you with that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜