Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the text for tooltip with $.data (not $.attr) #3477

Closed
keriati opened this issue May 14, 2012 · 2 comments
Closed

Get the text for tooltip with $.data (not $.attr) #3477

keriati opened this issue May 14, 2012 · 2 comments
Labels

Comments

@keriati
Copy link

keriati commented May 14, 2012

Hi!

At the moment you are getting the text for tooltip like this:

title = $e.attr('data-original-title')

The bad thing is, if i want to use the tooltip with a "created" element like:

$('<a/>').data('original-title', 'This is some text');

it won't work.

Maybe switch

.attr('data-original-title')

to

.data('original-title')

in https://github.com/twitter/bootstrap/blob/master/js/bootstrap-tooltip.js

@fat
Copy link
Member

fat commented May 20, 2012

Not crazy about using the data method here - it does some other weird stuff. You shouldn't be setting original-title manually anyways. If you do want to though, just include it in your template, it's much cleaner that way:

$('<a data-original-title=foo></a>')

@fat fat closed this as completed May 20, 2012
@keriati
Copy link
Author

keriati commented May 21, 2012

OK, still i think it would be safe to use $.data for only getting this value.

My workaround for the moment is like:

$('<a/>').attr('data-original-title', 'some text');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants