2

I have the following code that grabs the text in xml nodes

$(xml).find('entry').each(function(){
     alert($(this).find('author').text());
});

This will alert what ever text happens to be in each <name>

I am struggling to get the text value in a node that looks like this -

<im:name>

Changing my code to look like this -

$(xml).find('entry').each(function(){
     alert($(this).find('im:name').text());
});

Doesn't work, can someone point me in the right direction please.

I have tried searching but don't know what to call a node that is in this format!

Thanks

1 Answer 1

2

You can escape the :.

alert($(this).find('im\\:name').text());

http://jsfiddle.net/6Y2ff/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.