Skip to content | Skip to navigation

Blog
what's happening

A few thoughts and ideas, a little sharing of information & some interesting information on what we're up to and what we're building for our clients. Remember to add our RSS feed to your last of feeds!

We'll contact you

Contact form
Customer logo
Twitter icon


Recent blogs

Popular blog tags

SI Works blog


I came across this really nifty little script on Elliot Swan's website while looking for something to help me with a task I have, the task is to copy an element and everything inside the element. this works great, I've made my own small tweaks in order to make sure it 100% suits the application I'm using it for, other than that, nice one.

var Move =	{
copy	:   function(e, target)	{
var eId      = $(e);
var copyE    = eId.cloneNode(true);
var cLength  = copyE.childNodes.length -1;
copyE.id     = e+'-copy';
for(var i = 0; cLength >= i;  i++)	{
if(copyE.childNodes[i].id) {
var cNode   = copyE.childNodes[i];
var firstId = cNode.id;
cNode.id    = firstId+'-copy'; }
}
$(target).appendChild(copyE);
},
element:  function(e, target, type)	{
var eId =  $(e);
if(type == 'move') {
$(target).appendChild(eId);
}
else if(type == 'copy')	{
this.copy(e, target);
}
}
}

Take a look at the entry for this and find more instructions.

Digg it!Add to your del.icio.usAdd to TechnoratiTweet this postShare this on facebook

Current Comments

There are currently no comments Why don't you be the first?

Post a comment

Capcha image