0

I have problem with . It is inserting some attributes like below in the html tags. jQuery110208269020320702063="365"

<SPAN class=EditNotAllowed title="Label Editing not allowed" jQuery110208269020320702063="366" jQuery11020551343224003024="366">3.3.</SPAN>

I have no idea about stopping these getting inserted into html tags. How i can stop these...?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
Ravi MCA
  • 2,491
  • 4
  • 20
  • 30
  • 1
    how are you adding the dom/html? – Milind Anantwar Jun 09 '14 at 10:12
  • 1
    why do you want to stop it? it is an harmless attribute used internally by jQuery(expando attribute) – Arun P Johny Jun 09 '14 at 10:16
  • see http://stackoverflow.com/questions/7150592/why-does-my-form-element-have-a-random-jquery-attribute & http://stackoverflow.com/questions/3922441/what-is-the-meaning-of-jquery-random-attributes-in-html-expando-attribute – Arun P Johny Jun 09 '14 at 10:17
  • Off Topic Comment but still i gotta ask this who's @AnoopJoshi? – Amit Singh Jun 09 '14 at 10:24
  • What code do you use to get the HTML? jQuery should strip these attributes out for you. Also, what version of jQuery is this? – lonesomeday Jun 09 '14 at 10:27
  • @lonesomeday i'm using jquery-1.10.2 and the code wich i'm using is document.getElementById("Filearea").innerHTML – Ravi MCA Jun 09 '14 at 10:32
  • @ArunPJohny this is html file converted from xml and included into web page(of course that's what my application do). Once my work is done. It should be reverted to xml format. when this is converted back to xml my xml parses throwing errors because of these attributes. – Ravi MCA Jun 09 '14 at 10:36
  • `$( '#Filearea' ).html()` instead of using the basic javascript method, don't know if jQuery will strip those for you, but, you know... if you're using the library might as well use it for reading what you're adding? – Gonçalo Vieira Jun 09 '14 at 10:39

1 Answers1

0

You say in the comments above that you use document.getElementById("Filearea").innerHTML to get the HTML out again. Don't do this.

jQuery inserts these properties to make its functionality work (data and events, principally). For compatibility in all browsers (IIRC this only affects old IE) you have to use the jQuery method rather than the native DOM method.

$('#Filearea').html()

This should work.

lonesomeday
  • 233,373
  • 50
  • 316
  • 318