<p>Suppose I have a simple XHTML document that uses a custom namespace for attributes:</p>

<pre><code>&lt;html xmlns="..." xmlns:custom="http://www.example.com/ns"&gt;
    ...
    &lt;div class="foo" custom:attr="bla"/&gt;
    ...
&lt;/html&gt;
</code></pre>

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

<pre><code>$("div[custom:attr]")
</code></pre>

<p>does not work. (Tried with Firefox only, so far.)</p>

You should use
```
$('div').attr('custom:attr')
```
.