Jquery 1.6.1 - xml selection

In jQuery 1.4.2, I was able to select the xml located on my html page by doing the following:

var xmlSettings = $("#xmlSettings")[0]; 

it is the same as:

 document.getElementById("xmlSettings"); //this still works fine 

In jquery 1.6.1 xmlSettings undefined. all i did was upgrade my jquery from 1.4.2 to 1.6.1 and now it doesn't work.

Is there any other choice I need to make, or do I need to add a plugin?

xml on the Html page:

 <xml id="xmlSettings"> <items> <item name="Test1">Test data 1</item> <item name="Test2">Test data 2</item> <item name="Test3">Test data 3</item> </items> </xml> 

thanks in advance,

[SOLVED] Thanks Felix Kling

The problem seems to be one of the following:

1) IE9 does not correctly display IE8 standards mode. I recently upgraded to IE9, but my application still needs to run in IE8 standard mode, so I made it render in IE8 in IE8 using X-UA-compatible IE = 8

2) I also updated my jquery file from 1.4.2 to 1.6.1

but it could be a combination of these things. I'm not sure if in any case using normal document.getElementById("xmlSettings"); still working fine, so at the same time I will use this but very strange problem. I would not be surprised if this is an IE9 problem. Or maybe I'll stay on jquery 1.4.2.

+4
source share
3 answers

This is the real reason it doesn't work: regression in jQuery 1.4.2 .

+1
source

You probably don't need [0], because id is an exceptional value and does not return a list of objects, for example, a class search.

0
source

I answered my question, as suggested by Arend

[SOLVED] Thanks Felix Kling

The problem seems to be one of the following:

1) IE9 does not correctly display IE8 standards mode. I recently upgraded to IE9, but my application still needs to work in IE8 standard mode, so I made it render in IE8 in IE8 using X-UA-compatible IE = 8. Another thing about X-UA-Compatible, rather uses IE = EmulateIE8 not IE = 8. But even if you use IE = EmulateIE8, it still doesn't play well with jquery 1.6.1. Therefore, it is better to use IE9 standard mode, which works great, so busy conversion code, which will be standard, will in any case be better matched in the long run.

2) I also updated my jquery file from 1.4.2 to 1.6.1

but it could be a combination of these things. I'm not sure if in any case using normal document.getElementById("xmlSettings"); still works fine, so at the same time I will use this but very strange problem. I would not be surprised if this is an IE9 problem. Or maybe I'll stay on jquery 1.4.2.

0
source

All Articles