0

$('#attachment-deletion').cloneNode(true);

IE reports Object doesn't support this property or method

what can I do about this? cloneNode was my solution to IE8 not recognizing jquery's clone method, which it didn't even throw an error about

CQM
  • 42,592
  • 75
  • 224
  • 366
  • Have you tried: `$('#attachment-deletion')[0].cloneNode(true);` ? – A. Wolff Jun 18 '13 at 16:21
  • or just `$('#attachment-deletion').clone(true);` – adeneo Jun 18 '13 at 16:23
  • @roasted, a combination of element zero and converting back to jquery objects worked for me – CQM Jun 18 '13 at 17:47
  • so could you post the code which works for you?! – A. Wolff Jun 18 '13 at 17:50
  • 1
    @roasted `var attachmentDeleteMainModalClone = $('#attachment-deletion')[0].cloneNode(true);` `$(attachmentDeleteMainModalClone).attr('id', 'attachment-deletion-'+'main');` not mentioned earlier is that I was having trouble also accessing the object after the clone method, now its all fixed – CQM Jun 18 '13 at 18:34
  • you could use then: `attachmentDeleteMainModalClone.id = 'attachment-deletion-main'` even its properly change nothing. BTW, thx for sharing your solution – A. Wolff Jun 18 '13 at 18:39

1 Answers1

0

cloneNode is a native javascript method that doesn't work on jQuery objects, you have decide what to use :

jQuery

$('#attachment-deletion').clone(true);

or plain JS

document.getElementById('attachment-deletion').cloneNode(true);

Edit: You can also Combine Plain JS with jQuery if you need to:

$('#attachment-deletion').get(0).cloneNode(true);
// or
$('#attachment-deletion')[0].cloneNode(true);
pyronaur
  • 3,515
  • 6
  • 35
  • 52
adeneo
  • 312,895
  • 29
  • 395
  • 388