Edit: Important: It is extremely unlikely that anybody who has come across this will have the exact same problem as me - check my answer below for my very obscu
Wow! Well that was crazy.
Turns out the problem is because of this code that I have in an included JS file:
jQuery.fn._init = jQuery.fn.init
jQuery.fn.init = function(selector, context) {
if (typeof selector === 'string') {
return jQuery.fn._init(selector, context).data('selector', selector);
}
return jQuery.fn._init(selector, context);
};
I am using jQuery 1.2.6.
The code above came from this post How do I get a jQuery selector's expression as text?. i think the author since rewrote it, but its breaking this for some strange reason.
The DIV just disappears - but i got thrown because replaceWith() DID work and so did append(). I guess some of the other methods mus internally being tripped up by this but those two werent.
Thanks for everyones quick suggestions. I'm sure they'll help out others some point.