jQuery - Find element with rel attribute

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();

Answers


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

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


the exact one

$('i[rel="tooltip"]').tooltip()

yon can select all elements with href att with this selector

$(document).ready(function()
{

$("[rel]")

});

Need Your Help

Paperclip - rename file before saving

ruby-on-rails-3 paperclip file-rename

I use this method for renaming the image before the saving:

After deleting a binary file from Git history why is my repository still large?

git version-control github

So let me preface this question by saying that I am aware of the previous questions pertaining to subject on Stackoverflow. In fact I've tried all the solutions I could find but there is a binary f...