Toniq
Toniq

Reputation: 5016

JQuery selector namespace

I am trying to target this node:

<ns1:image href="http://broadcast.lds.org/XML/LDSRadio/LDSRadio_EnduringItWell.jpg" />

from here (http://feeds.lds.org/EnduringItWell)

It works if I do this:

$(result).find('ns1\\:image').length

How can I write the selector so it selects it without 'ns1'? (because this 'ns1' can be something different)

I tried this but it doesnt work:

 $(result).find('\\:image').length

Upvotes: 2

Views: 84

Answers (1)

Rajaprabhu Aravindasamy
Rajaprabhu Aravindasamy

Reputation: 67217

You can't select it with direct selectors instead you can do,

$(result).find("*").filter(function(){
  return this.tagName.toLowerCase().indexOf(":image") > -1;
});

DEMO

Upvotes: 1

Related Questions