jQuery的UI选项卡加载事件不会触发 [英] jquery ui tabs load event does not fire

查看:192
本文介绍了jQuery的UI选项卡加载事件不会触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下非常简单的代码:

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

这成功将新的选项卡面板添加到现有的选项卡控件.但是,一旦激活,load函数就不会触发.

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

我的错误是什么? (没有javascript例外)

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

推荐答案

请尝试以下操作,因为在创建标签页时您没有这样做:

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');
}

首先要确保它安全,但这会绑定到 tabsload事件代替load选项/处理程序,该选项/处理程序在初始窗口小部件创建后未设置.

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.

这篇关于jQuery的UI选项卡加载事件不会触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆