Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#9595 closed bug (duplicate)

Tooltip doesn't change on ajax call

Reported by: camacici Owned by:
Priority: minor Milestone: none
Component: ui.tooltip Version: 1.9.2
Keywords: Cc:
Blocked by: Blocking:

Description

Hi,
I need to change the title attribute when I click the element using an ajax call, but the tooltip still remains the same.
I found a workaround, but I don't like it, it's a hack ...
I must hide the element before the ajax call and when the call has ended I can change the title and then I must re-show the element. It's run but I see the element disappearing for a short while of time.

You can found an example here: http://jsfiddle.net/9JgZT/2/

Best regards,
Michele

Change History (4)

comment:1 Changed 6 years ago by tj.vantoll

Hi Michele,

Thanks for taking the time to contribute to the jQuery UI project. Here's a test case that shows the AJAX requests working - http://jsfiddle.net/tj_vantoll/M9SXe/.

Someone else on the team will have to correct me if I'm wrong, but I believe that you cannot use delegated tooltips and get the ability to change the content dynamically.

You can explicitly create tooltip widgets and this works fine - http://jsfiddle.net/tj_vantoll/Tgg8Y/.

comment:2 Changed 6 years ago by Scott González

Resolution: duplicate
Status: newclosed

Duplicate of #8925.

comment:3 Changed 6 years ago by camacici

tj.vantoll, I know that in http://jsfiddle.net/tj_vantoll/M9SXe/ there is an example of code working ... that is my code! The code used in http://jsfiddle.net/9JgZT/2/ (my code) is the same in http://jsfiddle.net/tj_vantoll/M9SXe/ (your code)!

And last I don't understand why the code $div.tooltip("option", "content", "changed!") works fine in your last example (http://jsfiddle.net/tj_vantoll/Tgg8Y/) but in my code fails; the only difference is the initialization of tooltip: $(document).tooltip() VS $("[title]").tooltip()

comment:4 in reply to:  3 Changed 6 years ago by tj.vantoll

Replying to camacici:

tj.vantoll, I know that in http://jsfiddle.net/tj_vantoll/M9SXe/ there is an example of code working ... that is my code!

I added url: "/echo/json" to the ajax calls so they would work in jsFiddle.

And last I don't understand why the code $div.tooltip("option", "content", "changed!") works fine in your last example (http://jsfiddle.net/tj_vantoll/Tgg8Y/) but in my code fails; the only difference is the initialization of tooltip: $(document).tooltip() VS $("[title]").tooltip()

The difference is explicitly creating the tooltip widget on the element vs using event delegation. If you need further assistance please use the forums or Stack Overflow.

Note: See TracTickets for help on using tickets.