jQuery attribute selectors: How to query for an attribute with a custom namespace

Posted by Sebastian Rittau on Stack Overflow See other posts from Stack Overflow or by Sebastian Rittau
Published on 2008-09-18T10:38:41Z Indexed on 2010/05/28 9:21 UTC
Read the original article Hit count: 215

Filed under:
|

Suppose I have a simple XHTML document that uses a custom namespace for attributes:

<html xmlns="..." custom:xmlns="http://www.example.com/ns">
    ...
    <div class="foo" custom:attr="bla"/>
    ...
</html>

How do I match each element that has a certain custom attribute using jQuery? Using

$("div[custom:attr]")

does not work. (Tried with Firefox only, so far.)

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery