?
Solved

jQuery/JavaScript obtain Element name of root element in XML

Posted on 2011-10-23
2
Medium Priority
?
378 Views
Last Modified: 2012-05-12
experts,

I have the following bit of code that reads an xml file;
jQuery.get(xml, function (data) {

}

Open in new window


I want to get the root element's name.
I have read that the following will select the root element;
jQuery(data).filter(":first")

Open in new window


what do I add to get the name of this root element?
0
Comment
Question by:thydzik
2 Comments
 
LVL 83

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 37013919
jQuery.get(xml, function (data) {
      var Element_name_of_root_element= data.documentElement.nodeName;
})

0
 
LVL 11

Author Closing Comment

by:thydzik
ID: 37013971
great!
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question