jquery easyui判断tabs是否存在,如果存在则选中

function addTab(subtitle,url,icon){.

//下面开始判断
   if(!$('#tabs').tabs('exists',subtitle)){

//不存在则add
    $('#tabs').tabs('add',{
     title:subtitle,
     content:createFrame(url),
     closable:true,
     icon:icon
    });

//存在则改为选中状态
   }else{
    $('#tabs').tabs('select',subtitle);
   }
   //tabClose();
  }
  
  function createFrame(url)
  {
   var s = '<iframe scrolling="auto" frameborder="0"  src="'+url+'" style="width:100%;height:100%;"></iframe>';
   return s;
  }

猜你喜欢

转载自blog.csdn.net/weixin_41167961/article/details/82426196