jQuery - Find element with rel attribute

html, jquery

Solution

`$('i[rel]').tooltip();`

http://api.jquery.com/category/selectors/attribute-selectors/

Problem

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: ``` $('body').find('i').tooltip(); ``` 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. Thanks EDIT 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();`

Original source

Related problems