jquery ui tabs load event does not fire

梦想与她 提交于 2019-12-11 04:50:00

问题


I have got the following very simple code:

function init() {
    var articleTabs = $('#articleTabs');
    articleTabs.tabs('add',
            admin.pageVars.siteRoot + '/articles/themes/' + admin.pageVars.params.id, 'Temas');
    articleTabs.tabs({
        load : function(event, ui) {
            $('.jsonForm').jsonForm();
        }
    });
}

This successfully adds a new tab panel to an existing tab control. However upon activation, the load function does never fire.

What is my mistake? (There are no javascript exceptions)


回答1:


Try this instead, since you're not doing it at the time of the tabs creation:

function init() {
  var articleTabs = $('#articleTabs');
  articleTabs.bind('tabsload', function() {
    $('.jsonForm').jsonForm();
  });
  articleTabs.tabs('add', admin.pageVars.siteRoot + '/articles/themes/' + admin.pageVars.params.id, 'Temas');
}

This places it first to be safe, but this binds to the tabsload event instead of the load option/handler, which isn't set after initial widget creation.



来源:https://stackoverflow.com/questions/2615608/jquery-ui-tabs-load-event-does-not-fire

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!