i have a little question. How can i detect xml tag name compare with html element class? my code below:
var class_main_content = $('.main_content ul').find(this.class);
var xml_element_name = $(xml).find(class_main_content).text();
thx for help.
If your question is really “How do I get the class name from an html element?” then try something like this:
Using
$('.main_content ul')will return a jQuery object containing all ul elements that are descendants of elements with the class “main_content”. Calling.attr("class")on that jQuery object will retrieve the class of the first such element.You can then use that class name in the next statement:
If your
xmlhas an element with a tag name the same as the html element’s class then that xml element’s text will be returned.