我尝试在我的网站上的AJAX请求中添加图像,但由于某种原因,图像不显示。虽然,生成的HTML是正确的。在JQuery中使用.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>
我是不是忘了什么东西在我的代码,以确保该图片出现?
对不起,一个错字...我确实使用了src – Michiel 2013-03-01 11:34:12
如果你生成的HTML是正确的,那么问题就在其他地方。也许'图片预览'股利,或图像,是不可见的一些CSS相关的原因? – Aioros 2013-03-01 11:34:22
更改为src后,你是否仍然有问题? – 2013-03-01 11:34:49