0

我尝试在我的网站上的 AJAX 请求中添加图像,但由于某种原因,图像没有显示。虽然,生成的 HTML 是正确的。

这是我的代码:

$('.field-name-field-testimony-photo').wrap('<div class="picture-preview-container" />');
$('<div class="picture-preview" />').insertAfter('.picture-preview-container');

$('.form-item input.form-file', context).change(function() {
    $parent = $(this).closest('.form-item');
    $('.picture-preview').html('<img src="https://www.google.be/path-to-my-image.jpg" />');
});

据我所知,生成的 HTML 是正确的......

<div class="picture-preview">
    <img src="https://www.google.be/path-to-my-image.jpg" />
</div>

我是否忘记了代码中的某些内容以确保显示此图像?

4

1 回答 1

0

正如萨尔曼上面所说,看看

<img scr="https://www.google.be/path-to-my-image.jpg" />

在你的最后一行

并转换 scr ===> src

<img src="https://www.google.be/path-to-my-image.jpg" />
于 2013-03-01T11:34:18.020 回答