Apologies if this has been asked already, I can't find the answer in the jQuery docs.
How would I select all .tooltip
classes which have a [title]
attribute, and the [title]
attribute is not empty?
In other words, select these:
<a href="#" class="tooltip" title="YES">Foo</a>
<span class="tooltip" title="YES">Bar</span>
But not these:
<a href="#" class="tooltip" 开发者_JS百科title="">Empty title attribute.</a>
<span class="tooltip">No title attribute.</span>
Try this selector:
.tooltip[title]:not([title=""])
精彩评论