Get xml with clicked class

I am currently working on a function with jQuery that searches for the class that was just clicked within xml. But the result only seems to parse me the last entered result. I keep struggeling to get this fixed so I hope someone on sitepoint is able to help me out.

The jquery looks like this:


$(".links dd").live("click",function(){
		var linkName = $(this).attr('class');
		description(linkName);
	});	

function description(x){
$(".description").replaceWith('<div class="description">' + description + '</div>');
		}

and the XML tree like this:

<linklist>
	<link title="sitepoint">
	<class>sitepoint</class>
	<url>#/sitepoint/</url>
	<description> This is a excellent site to get help </description>	
        </link>

       <link title="google">
	<class>google</class>
	<url>#/google/</url>
	<description> The most used search engine nowadays </description>	
        </link>
</linklist>

In this case it would only show me the description of Google, even when I click to see the information/description about sitepoint.

Thanks in advance,
Mehk

I am still running into this problem, does anyone have an idea?

Mehk, can you show the code where you are loading in the XML and also where description is set as a var?

	$('#list').append('<dl class=\\'List\\'>');
	$.getXML('myData.xml', function(data){
		for(i=0; i<data.programs.length; i++) {
			var program = data.programs[i].program;
			//alert(data.programs[i].program.title);
		var $program = $(this);
		var title =  (program.title);
		var class = program.class;
		var url = (program.url);	
		var description = (program.description);
		var imageurl = $program.attr('imageurl');
		var html = '<dt> <img class="Image" alt="" src="' + imageurl + '" /> </dt>';
		html += '<dd class=' + class + '>';
		html += '<a href= ' + url + ' id="nextbuttonLink" class="control">' + title + '</a>';
		/* html += '<p class="title">' + title + '</p>'; */
		html += '</dd>';
	
		html += '</dl>';
		$('#List dl').append(html);
		}

Anyone?