jQuery - Find element with rel attribute

Go To StackoverFlow.com


I have two kind of elements

<i rel="tooltip" class='icon-ok'>
<i title="Teste" class='icon-info'>

The first one is a tooltip effect, the second a popover

What I'm trying to do is avoid rework so I don't need to create a script based on the class on every html I have.

I did this on my base html:


The problem is that it is adding the tooltip effect on the other <i> elements without the rel attribute.

I need to search for elements with the rel attribute and set the tooltip effect on them.



If I try to do the opposite of what was said on the correct answer, get the <i> elements without the rel attribute. Found the solution here: jQuery selectors - find objects without specified attribute

vrutberg - jQuery("li:not([style])").hide();

2012-04-04 16:47
by Gerep




2012-04-04 16:48
by js1568
Or $('body').find('i[rel=tooltip]').tooltip(); as well - Whymarrh 2012-04-04 16:50
and is it possible to check in the popover situation, without the rel - Gerep 2012-04-04 17:01
found a solution: http://goo.gl/sHr8 - Gerep 2012-04-04 17:05


the exact one

2012-04-04 16:53
by dku.rajkumar
quotes help for space - Meredith 2014-06-27 23:53


yon can select all elements with href att with this selector



2012-04-04 16:52
by Nudier Mena