Displaying attached images in Display Form
Posted: 04 Aug 2017
The following code displays any single attachment just fine:
When I add a second (or more) attachment(s) I start getting the following error:
Code: Select all
var preview = "";
$("a[href*='/Attachments/'").each(function(){
preview += "<tr><td><img class='thumbnail' src='" + $(this).attr("href") + "'></td></tr></table>";
});
if (preview == "") {
preview = "<tr><td>There are no items to display.</td></tr>"
}
$(".imgPreview").html(preview);
Any suggestions?plumsail.fd.jquery.js:4 Uncaught TypeError: Cannot read property 'childNodes' of null
at Function.buildFragment (plumsail.fd.jquery.js:4)
at m.fn.init.domManip (plumsail.fd.jquery.js:4)
at m.fn.init.append (plumsail.fd.jquery.js:4)
at m.fn.init.<anonymous> (plumsail.fd.jquery.js:4)
at m.access (plumsail.fd.jquery.js:4)
at m.fn.init.html (plumsail.fd.jquery.js:4)
at HTMLDocument.<anonymous> (fd_Item_DisplayForm.aspx:571)
at j (plumsail.fd.jquery.js:2)
at Object.fireWith [as resolveWith] (plumsail.fd.jquery.js:2)
at Function.ready (plumsail.fd.jquery.js:2)