jQuery(document).ready() is executed before the image exists in the
DOM.
I tested your above code with the test() function defined as:
function test() {
var image = '<a href="image.gif" rel="facebox"><img src="image.gif"
width="200"
height="200" align="absmiddle" alt="Click for larger picture"></
a>';
//$("#imageDIV").html(image);
//$("#imageDIV > a[rel*=facebox]").facebox();
document.getElementById('imageDIV').innerHTML=image;
}
This displays the image but, as you describe, doesn't use facebox when
you click on it. The reason is that you have to activate facebox on
that link once you have added it to the DOM. Since facebox is
designed to work as a jQuery plugin you really can't give the link an
ID and then make a second call to document.getElementById to call
facebox() to initialize it.
Since you have jQuery loaded anyway the easiest way to handle this is
to just use jQuery for everything. Remove the document.getElementById
line and uncomment the 2 lines above it.
jQuery adds the image string to the imageDIV and then selects just the
anchors in that one DIV to initialize facebox on.
I hope this helps.
-Jon
On May 8, 3:49 am, "paul.roberts" <
paul.robe...@riddenpath.co.uk>
wrote: