Calling an event after a jquery tab load
Asked Answered
K

3

13

I'm using jQuery tabs. In one of the tabs is a wysiwyg editor that needs to be refreshed after the tab is displayed, but I can't figure out if there is an event that fires after the tab is loaded.

From my understanding, the load event is only for tabs that use ajax calls. I've tried using it but it doesn't fire: jQuery ui tabs load/tabsload event does not fire

In that example they use an iframe, which has a load event that is triggered. I'm just using divs, which don't have a load event, and nothing like an onshow event listener.

The closest I've been able to get is the tabsselect event which fires when a tab is clicked, but before the new tab is loaded.

Is there any event that fires after the tab is loaded when I'm not using ajax?

Thanks

Klusek answered 8/4, 2012 at 15:16 Comment(2)
Can you specify which tab library you are using? I'm guessing jQuery UI. Have u already tried the "tabsshow"-event?Auguste
I hadn't tried tabsshow, tabsshow was exactly what I needed. Thanks! @mightyuhuKlusek
P
10

Did you try event-show? http://jqueryui.com/demos/tabs/#event-show

$( ".selector" ).tabs({
   show: function(event, ui) { ... }
});
Pelias answered 8/4, 2012 at 15:30 Comment(0)
S
5

The show event did not work for me, but the create event did:

$( ".selector" ).tabs({
   create: function(event, ui) { ... }
});

http://api.jqueryui.com/tabs/#event-create

Synod answered 28/5, 2014 at 4:16 Comment(3)
same thing here, perhaps they changed their method names when upgrading to the next versionSurmount
create fires when the tab is created, not when it's clicked and displayed.Lorollas
'create' fires before the content has finished loading, 'load' fires after the content is loading. It all depends if you need to perform tasks on the content within the tab, in which case 'load' would be more appropriate.Marindamarinduque
A
2

Now the event is called activate

$( ".selector" ).tabs({
  activate: function(event, ui) { ... }
});

http://api.jqueryui.com/tabs/#event-activate

Ancestor answered 8/2, 2019 at 12:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.