Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (28 sloc) 882 Bytes
<?xml version="1.0"?>
<entry type="selector" name="attributeHas" return="">
<title>Has Attribute Selector [name]</title>
<argument name="attribute" type="String">
<desc>An attribute name.</desc>
<desc>Selects elements that have the specified attribute, with any value. </desc>
<desc>Bind a single click that adds the div id to its text.</desc>
$('div[id]').one('click', function(){
var idString = $(this).text() + ' = ' + $(this).attr('id');
<html><![CDATA[<div>no id</div>
<div id="hey">with id</div>
<div id="there">has an id</div>
<category slug="selectors/attribute-selectors"/>
<category slug="version/1.0"/>
Jump to Line
Something went wrong with that request. Please try again.