开发者

jQuery - image SRC

开发者 https://www.devze.com 2023-04-04 04:56 出处:网络
Am I doing something wrong?#contactImg is not getting the src pass开发者_如何学Goed var clickedImage = $(\'img.img_rightThumb\').attr(\"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

精彩评论

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