开发者

jQuery, How to target very specific selectors?

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=""])
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜