Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (28 sloc) 0.882 kb
<?xml version="1.0"?>
<entry type="selector" name="attributeHas" return="">
<title>Has Attribute Selector [name]</title>
<sample>[attribute]</sample>
<signature>
<added>1.0</added>
<argument name="attribute" type="String">
<desc>An attribute name.</desc>
</argument>
</signature>
<desc>Selects elements that have the specified attribute, with any value. </desc>
<longdesc/>
<example>
<desc>Bind a single click that adds the div id to its text.</desc>
<code><![CDATA[
$('div[id]').one('click', function(){
var idString = $(this).text() + ' = ' + $(this).attr('id');
$(this).text(idString);
});
]]></code>
<html><![CDATA[<div>no id</div>
<div id="hey">with id</div>
<div id="there">has an id</div>
<div>nope</div>]]></html>
</example>
<category slug="selectors/attribute-selectors"/>
<category slug="version/1.0"/>
</entry>
Jump to Line
Something went wrong with that request. Please try again.