Sorry for my poor English. I come across with a odd problem. Here is a html file piece: <p id="test"><a class="here" href="#somewhere">something</a> some other html tags and content</p> and I attach a click event handler to the anchor element, the js code is like this: $('#here').click( function(){ alert('here') } );
Now I want to clone the anchor and all its siblings to anther <p>, but I do not use the clone(), instead, copy the html: var newp = $('#another_p').html( $('test').html() ) and then I remove the anchor: newp.find('a.here').remove() The problem is, event handler of the origin anchor( '#test a.here' ) are removed as well. This problem only happens in IE. The cause is IE takes elem[ expando ] = ++uuid; as elem.setAttribute( expando, ++uuid ); so the statement: $('test').html() will return something like this: <p id="test"><a class="here" href="#somewhere" jquery20080519="61">..... when append this html piece to another element and remove the anchor, the jquery cache with key 61 will also be removed I know this usage is strange, but I think the solution is simple as well: just remove expando before return the innerHTML 452 html: function( value ) { 453 return value == undefined ? 454 (this.length ? 455 this[0].innerHTML : 456 null) : 457 this.empty().append( value ); 458 },