i have a jQuery dropdown list that is populated with an XML file - how can i populate a div with additional information (within the XML file) that is linked to whatever is selected in the drop down?
// populate dropdown menu
var select = $("#mySelect");
$(xml).find("glossary_term").each(function(){
var glossary_term_heading = $(this).find('glossary_term_heading').text();
select.append("<option id='"+glossary_term_heading+"'>"+glossary_term_heading+"</option>");
}); // $(xml).find("glossary_term") - end
// initial display of message to select a term
select.children(":first").text("please make a selection").attr("selected",true);
Below is a sample of my xml file - it is the glossary_term_content i want to populate in a div when the glossary_term_content is selected in the dropdown.
Thanks in advance for any help.
<glossary>
<glossary_term>
<glossary_term_heading><![CDATA[title 1]]></glossary_term_heading>
<glossary_term_content><![CDATA[<P>Content 1</P>]]>
</glossary_term_content>
</glossary_term>
glossary_term>
<glossary_term_heading><![CDATA[title 2]]></glossary_term_heading>
<glossary_term_content><![CDATA[<P>Content 2</P>]]>
</glossary_term_content>
</glossary_term>
</glossary>
No comments:
Post a Comment