I am trying to load some text from an external file, append this and then pass it to a div container but cannot get the append to work
$.get('gallery-lightbox.html', function (data) {
var lb_content = data;
$(lb_content).append('<p>some text</p>');
$('#lightbox').load(lb_content);
positionLightboxImage();
});
Try this
OR
And make sure your
gallery-lightbox.htmlfile doesn’t have<html>or<body>tag etc. it should only have the<div>or an element that you can actually put inside your#lightbox