Selector Question

Selector Question

Hello All,

I am wondering if someone could explain to me what is going on in this code:

var xmlDocPath='business_courses.xml';

$.get(xmlDocPath,function(data){

      $('course',data).each(function(){

            // Code to be executed 

      }

}

Specifically I am not understanding the selector  $('course',data). What is it selecting? I do not see this form of the jQuery selector anywhere online. Is it selecting all of the "course 'elements in the XML document? If so why is it that I cannot display the course elements like this:

elems = $('course',data);

 txt  = "";

 for (var x in elems){

        txt += x + ":</br>" + elems[x] + "</br></br> ";

}

document.getElementById("display").innerHTML= txt;


Thanks in advance for any help you can give me.

PeteM