div onload clones and insert itself to another div with jquery
I want to do something like this:
when the whole page is loaded, a div clones itself and insert .after to another div. And I have around 100 of those divs cloning and inserting itself to different divs.
The problem is, div itself doesn't support onload(), so what's the most efficient way to have those div insert itself 开发者_StackOverflowusing jQuery?
Thanks!!
edit: never mind i think i will just use document.ready to clone those things
Not sure exacly what your wanting to do but I know you can hook up .load to a div to trigger when its loaded
$('div').load(function(){
$(this).clone().appendTo('.test');
}).each(function () {
// Some Browsers dont play nice with .load
if (this.complete || ($.browser.msie && parseInt($.browser.version, 10) === 6)) {
$(this).trigger("load");
}
});
精彩评论