Thanks, elegant solution ! X+
On Apr 13, 11:58 am, Klaus Hartl <[EMAIL PROTECTED]> wrote: > xavier schrieb: > > > Hi, > > > When I clone an element that has an accesskey, it's copied to the > > cloned element as well. > > > Then you end up with two different elements having the same accesskey. > > Obvioulsy no good. > > > Do I have to call .removeAttr('accesskey') method on each cloned node > > or is there a better way ? > > > Thanks in advance, > > > Xavier > > I think it is probably too much overhead to add a list of undesired > attributes that won't cloned to include in jQuery. Similiar problems > occur for elements with an id that get cloned. > > You could write your own little helper: > > jQuery.fn.cleanClone = function(deep) { > return this > .clone(deep) > .removeAttr('accesskey') > .removeAttr('id'); > // add more attributes... > > }; > > Use instead clone: > > $('[EMAIL PROTECTED]').cleanClone().appendTo('body'); > > -- Klaus