title: Using jquery easyui, how to create a tab by a link which is in a tab?
body: <p><a href="http://www.jeasyui.com/documentation/tabs.php" rel="nofollow">Tabs document</a></p>
  
  <p>I would like to create a new tab which from the link that is in a tab
  .</p>
  
  <p>for example, in tab a , there is a link "open tab b" , and it should add a tab b , </p>
  
  <p>I tried the way create tab that when the link is not in tab (which is working) </p>
  
  <p>however, in this case when i press it ,it has no response. Thank you</p>
  
  <pre><code>&lt;a href='#' onclick="addTab('Manage List','list/view.php')" class='btn'&gt;Manage List&lt;/a&gt;
  </code></pre>
  
  <p>addtab function</p>
  
  <pre><code>function addTab(title, url){  
      if ($('#tt').tabs('exists', title)){  
          $('#tt').tabs('select', title);  
      } else {  
          var content = '&lt;iframe scrolling="auto" frameborder="0"  src="'+url+'" style="width:100%;height:100%;"&gt;&lt;/iframe&gt;';  
          $('#tt').tabs('add',{  
              title:title,  
              content:content,  
              closable:true  
          });  
      }  
  }  
  </code></pre>
  
  <p>full page</p>
  
  <pre><code>&lt;?
  include("../connection/conn.php");
  session_start();?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  
  &lt;style type="text/css"&gt;
        @import "../plugin/easyui/themes/default/easyui.css";
        @import "../plugin/easyui/themes/icon.css";
        @import "../plugin/bootstrap/css/bootstrap.css";
        @import "../plugin/bootstrap/css/bootstrap-responsive.css";
        @import "../style/form.css";
  &lt;/style&gt;
  &lt;script src="../plugin/jquery-1.6.1.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="../plugin/easyui/jquery.easyui.min.js"&gt;&lt;/script&gt;
  &lt;script src="../plugin/jquery.validate.min.js"&gt;&lt;/script&gt;
  
  &lt;script&gt;  
  $(document).ready(function(){   
  $("#addlist").validate();
  });
  
  function addTab(title, url){  
      if ($('#tt').tabs('exists', title)){  
          $('#tt').tabs('select', title);  
      } else {  
          var content = '&lt;iframe scrolling="auto" frameborder="0"  src="'+url+'" style="width:100%;height:100%;"&gt;&lt;/iframe&gt;';  
          $('#tt').tabs('add',{  
              title:title,  
              content:content,  
              closable:true  
          });  
      }  
  }  
  
  $(function(){
    $("#closeTab").click(function() {
              $.post("clear.php",function(data){
               window.parent.$('#tt').tabs('close','Create List'); 
               location.reload();     
        });
    });
  });
  
  &lt;/script&gt;
  
  
  &lt;/head&gt;
  &lt;body style="background:#7C96A8;"&gt;
  
  &lt;div id="stylized" class="myform"&gt;
  &lt;form id="addlist" method="post" action="addNext.php" &gt;
  &lt;h1&gt;Create your new subscriber list&lt;/h1&gt; 
  &lt;p&gt;Create a new list before adding subscriber &lt;label class="right"&gt;&lt;span class="label label-warning"&gt;&lt;em class="dot"&gt;*&lt;/em&gt;   Indicates required&lt;/span&gt;&lt;/p&gt;
  
  &lt;label&gt;&lt;em class="dot"&gt;*&lt;/em&gt; &lt;strong&gt;List name:&lt;/strong&gt;
  &lt;span class="small"&gt;Add your list name&lt;/span&gt;
  &lt;/label&gt;
  &lt;input id="lname" name="lname" class="required" &lt;?if (isset($_SESSION['lname'])) { echo "value=".$_SESSION['lname'];}?&gt; /&gt;
  
  &lt;div class="spacer"&gt;&lt;/div&gt;
  
  &lt;label&gt;&lt;strong&gt;Reminder:&lt;/strong&gt;
  &lt;span class="small"&gt;Remind the details of your list&lt;/span&gt;
  &lt;/label&gt;
  &lt;textarea id="creminder" style="width:300px" name="creminder" cols="15" rows="10"&gt;&lt;?if (isset($_SESSION['creminder'])) {echo $_SESSION['creminder'];}?&gt;&lt;/textarea&gt;
  
  &lt;div class="spacer"&gt;&lt;/div&gt;
  
  &lt;p&gt;Email me when ...&lt;/p&gt; 
  &lt;label&gt;People subscribe:&lt;/label&gt; &lt;input type="checkbox" class="checkbox" name="subscribe" value="1" &lt;? if (isset($_SESSION['subscribe']) &amp;&amp; $_SESSION['subscribe']==1){echo "checked='yes'";}?&gt; &gt;
  &lt;label&gt;People unsubscribe:&lt;/label&gt; &lt;input type="checkbox" class="checkbox" name="unsubscribe" value="1" &lt;? if (isset($_SESSION['unsubscribe']) &amp;&amp; $_SESSION['unsubscribe']==1){echo "checked='yes'";}?&gt; &gt;
  
  
  &lt;div class="spacer"&gt;&lt;/div&gt;
  &lt;input type="button" id="closeTab" value="Cancel" class="btn" style="width:100px"/&gt; 
  &lt;input type="submit" value="Next" class="btn btn-primary" style="width:100px"/&gt;
  
  &lt;div class="spacer"&gt;&lt;/div&gt;
  &lt;/form&gt;
  &lt;div class="spacer"&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  
  
  &lt;br&gt;&lt;br&gt;&lt;br&gt;
  &lt;div id="stylized" class="myform"&gt;
  
  &lt;?
  // list out the pervious create list
  try{
  $sql = '
      SELECT   *
      FROM     list,user_list
      WHERE    user_list.UserID=?
      AND list.ListID=user_list.ListID
  ';
  $stmt = $conn-&gt;prepare($sql);
  $stmt-&gt;execute(array($_SESSION['username']));
  $result= $stmt-&gt;fetchAll();
  $numRows= $stmt-&gt;rowCount();
  }
  catch(PDOException $e)
      {
      die ($e-&gt;getMessage().'&lt;a href="add.php"&gt; Back&lt;/a&gt;'); 
      }
  
  
  if ($numRows == 0) {
      echo '&lt;div style="text-align:center;font-weight:bold;"&gt;You have not created any list yet.&lt;/div&gt;';}
  else {
      echo '&lt;h1&gt;Your Subscriber List&lt;/h1&gt; &lt;p&gt;You have created '.$numRows.' list(s).&lt;/p&gt;';
  foreach ($result as $set) 
  {
      try{
  $sql = '
      SELECT   ls.SubID
      FROM     list_sub ls,user_list ul
      WHERE    ul.UserID=?
      AND ls.ListID='.$set['ListID'].'
      AND ls.ListID=ul.ListID
  ';
  $stmt = $conn-&gt;prepare($sql);
  $stmt-&gt;execute(array($_SESSION['username']));
  $numSubs= $stmt-&gt;rowCount();
  }
  catch(PDOException $e)
      {
      die ($e-&gt;getMessage().'&lt;a href="add.php"&gt; Back&lt;/a&gt;'); 
      }
  
  echo '&lt;span class="label"&gt;List Name&lt;/span&gt; : &lt;strong&gt;'.$set['ListName'].'&lt;/strong&gt;&lt;br&gt;&lt;br&gt;';
  echo '&lt;span class="label"&gt;Number of subscriber&lt;/span&gt; : &lt;strong&gt;'.$numSubs.'&lt;/strong&gt;&lt;br&gt;&lt;br&gt;';
  echo '&lt;span class="label"&gt;Create Date&lt;/span&gt; : &lt;strong&gt;'.$set['CreateDate'].'&lt;/strong&gt;&lt;br&gt;&lt;br&gt;';
  ?&gt;&lt;a href='#' onclick="addTab('Manage List','list/view.php')" class='btn'&gt;Manage List&lt;/a&gt;&lt;?
  echo '&lt;p&gt;&lt;/p&gt;';
  }}
      ?&gt;
  &lt;div class="spacer"&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  
  &lt;br&gt;&lt;br&gt;&lt;br&gt;
  &lt;div id="stylized" class="myform"&gt;
  
  &lt;?
  // list out the public list
  try{
  $query = '
      SELECT *
      FROM     list
      Where IsPublic=1
  ';
  $stmt = $conn-&gt;prepare($query);
  $stmt-&gt;execute();
  $result= $stmt-&gt;fetchAll();
  $num_rows= $stmt-&gt;rowCount();
  }
  catch(PDOException $e)
      {
      die ($e-&gt;getMessage().'&lt;a href="add.php"&gt; Back&lt;/a&gt;'); 
      }
  $conn = null;
  if ($num_rows == 0) {
      echo '&lt;div style="text-align:center;font-weight:bold;"&gt;There are no public list.&lt;/div&gt;';}
  else {
      echo '&lt;h1&gt;Public Subscriber List&lt;/h1&gt; &lt;p&gt;There are '.$num_rows.' list(s).&lt;/p&gt;';
  foreach ($result as $set) 
  {
      try{
  $sql = '
      SELECT   ls.SubID
      FROM     list_sub ls,user_list ul
      WHERE    ul.UserID=?
      AND ls.ListID='.$set['ListID'].'
      AND ls.ListID=ul.ListID
  ';
  $stmt = $conn-&gt;prepare($sql);
  $stmt-&gt;execute(array($_SESSION['username']));
  $numSubs= $stmt-&gt;rowCount();
  }
  catch(PDOException $e)
      {
      die ($e-&gt;getMessage().'&lt;a href="add.php"&gt; Back&lt;/a&gt;'); 
      }
  
  echo '&lt;span class="label"&gt;List Name&lt;/span&gt; : &lt;strong&gt;'.$set['ListName'].'&lt;/strong&gt;&lt;br&gt;&lt;br&gt;';
  echo '&lt;span class="label"&gt;Number of subscriber&lt;/span&gt; : &lt;strong&gt;'.$numSubs.'&lt;/strong&gt;&lt;br&gt;&lt;br&gt;';
  echo '&lt;span class="label"&gt;Create Date&lt;/span&gt; : &lt;strong&gt;'.$set['CreateDate'].'&lt;/strong&gt;&lt;br&gt;&lt;br&gt;';
  echo "&lt;a href='#' onclick='addTab('Manage List','list/view.php')' class='btn'&gt;Manage List&lt;/a&gt;"; // **********************the add tag link is here***************************//
  echo '&lt;p&gt;&lt;/p&gt;';
  
  }}
      ?&gt;
  &lt;div class="spacer"&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Updated:</p>
  
  <p>Still no response after i add the code?
      
      
      
      </p>
  
  <pre><code>&lt;style type="text/css"&gt;
        @import "../plugin/easyui/themes/default/easyui.css";
        @import "../plugin/easyui/themes/icon.css";
        @import "../plugin/bootstrap/css/bootstrap.css";
        @import "../plugin/bootstrap/css/bootstrap-responsive.css";
        @import "../style/form.css";
  &lt;/style&gt;
  &lt;script src="../plugin/jquery-1.6.1.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="../plugin/easyui/jquery.easyui.min.js"&gt;&lt;/script&gt;
  &lt;script src="../plugin/jquery.validate.min.js"&gt;&lt;/script&gt;
  
  &lt;script&gt;  
  $(document).ready(function(){   
  $("#addlist").validate();
  });
  
  $(function(){
    $("#closeTab").click(function() {
              $.post("clear.php",function(data){
               window.parent.$('#tt').tabs('close','Create List'); 
               location.reload();     
        });
    });
  });
  
  
  
  function addTab(title, url){  
      if ($('#tt').tabs('exists', title)){  
          $('#tt').tabs('select', title);  
      } else {  
          var content = '&lt;iframe scrolling="auto" frameborder="0"  src="'+url+'" style="width:100%;height:100%;"&gt;&lt;/iframe&gt;';  
          $('#tt').tabs('add',{  
              title:title, 
              content:content, 
              closable:true,
               tools:[{
                      iconCls:'icon-mini-refresh',
                      handler:function(){
                var tab = $('#tt').tabs('getSelected');
              $('#tt').tabs('update', {
                  tab: tab,
                  options:{
                      title:title,
                      content:content, 
                      closable:true
                  }
              });
          }                       
  
                  }]
          });  
      }  
  }    
  
          function init() {
              $("#addtab1").on("click",function() {
                  addTab("slashdot","http://www.slashdot.org/");
              });
              $("#addtab2").on("click",function() {
                  addTab("slashdot","http://www.slashdot.org/");
              });
          }
          $(init);
  
  
  &lt;/script&gt;
  
  
  &lt;/head&gt;
  &lt;body style="background:#7C96A8;padding:10px;"&gt;
  
  &lt;div id="stylized" class="myform"&gt;
  &lt;form id="addlist" method="post" action="addNext.php" &gt;
  &lt;h1&gt;Create your new subscriber list&lt;/h1&gt; 
  &lt;p&gt;Create a new list before adding subscriber &lt;label class="right"&gt;&lt;span class="label label-warning"&gt;&lt;em class="dot"&gt;*&lt;/em&gt;   Indicates required&lt;/span&gt;&lt;/p&gt;
  
  &lt;label&gt;&lt;em class="dot"&gt;*&lt;/em&gt; &lt;strong&gt;List name:&lt;/strong&gt;
  &lt;span class="small"&gt;Add your list name&lt;/span&gt;
  &lt;/label&gt;
  &lt;input id="lname" name="lname" class="required" &lt;?if (isset($_SESSION['lname'])) { echo "value=".$_SESSION['lname'];}?&gt; /&gt;
  
  &lt;div class="spacer"&gt;&lt;/div&gt;
  
  &lt;label&gt;&lt;strong&gt;Reminder:&lt;/strong&gt;
  &lt;span class="small"&gt;Remind the details of your list&lt;/span&gt;
  &lt;/label&gt;
  &lt;textarea id="creminder" style="width:300px" name="creminder" cols="15" rows="10"&gt;&lt;?if (isset($_SESSION['creminder'])) {echo $_SESSION['creminder'];}?&gt;&lt;/textarea&gt;
  
  &lt;div class="spacer"&gt;&lt;/div&gt;
  
  &lt;p&gt;Email me when ...&lt;/p&gt; 
  &lt;label&gt;People subscribe:&lt;/label&gt; &lt;input type="checkbox" class="checkbox" name="subscribe" value="1" &lt;? if (isset($_SESSION['subscribe']) &amp;&amp; $_SESSION['subscribe']==1){echo "checked='yes'";}?&gt; &gt;
  &lt;label&gt;People unsubscribe:&lt;/label&gt; &lt;input type="checkbox" class="checkbox" name="unsubscribe" value="1" &lt;? if (isset($_SESSION['unsubscribe']) &amp;&amp; $_SESSION['unsubscribe']==1){echo "checked='yes'";}?&gt; &gt;
  
  
  &lt;div class="spacer"&gt;&lt;/div&gt;
  &lt;input type="button" id="closeTab" value="Cancel" class="btn" style="width:100px"/&gt; 
  &lt;input type="submit" value="Next" class="btn btn-primary" style="width:100px"/&gt;
  
  &lt;div class="spacer"&gt;&lt;/div&gt;
  &lt;/form&gt;
  &lt;div class="spacer"&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  
  &lt;br&gt;&lt;br&gt;&lt;br&gt;
  &lt;div id="stylized" class="myform"&gt;
  
  &lt;?
  // list out the pervious create list
  try{
  $sql = '
      SELECT   *
      FROM     list,user_list
      WHERE    user_list.UserID=?
      AND list.ListID=user_list.ListID
  ';
  $stmt = $conn-&gt;prepare($sql);
  $stmt-&gt;execute(array($_SESSION['username']));
  $result= $stmt-&gt;fetchAll();
  $numRows= $stmt-&gt;rowCount();
  }
  catch(PDOException $e)
      {
      die ($e-&gt;getMessage().'&lt;a href="add.php"&gt; Back&lt;/a&gt;'); 
      }
  
  
  if ($numRows == 0) {
      echo '&lt;div style="text-align:center;font-weight:bold;"&gt;You have not created any list yet.&lt;/div&gt;';}
  else {
      echo '&lt;h1&gt;Your Subscriber List&lt;/h1&gt; &lt;p&gt;You have created '.$numRows.' list(s).&lt;/p&gt;';
  foreach ($result as $set) 
  {
      try{
  $sql = '
      SELECT   ls.SubID
      FROM     list_sub ls,user_list ul
      WHERE    ul.UserID=?
      AND ls.ListID='.$set['ListID'].'
      AND ls.ListID=ul.ListID
  ';
  $stmt = $conn-&gt;prepare($sql);
  $stmt-&gt;execute(array($_SESSION['username']));
  $numSubs= $stmt-&gt;rowCount();
  }
  catch(PDOException $e)
      {
      die ($e-&gt;getMessage().'&lt;a href="add.php"&gt; Back&lt;/a&gt;'); 
      }
  
  echo '&lt;span class="label"&gt;List Name&lt;/span&gt; : &lt;strong&gt;'.$set['ListName'].'&lt;/strong&gt;&lt;br&gt;&lt;br&gt;';
  echo '&lt;span class="label"&gt;Number of subscriber&lt;/span&gt; : &lt;strong&gt;'.$numSubs.'&lt;/strong&gt;&lt;br&gt;&lt;br&gt;';
  echo '&lt;span class="label"&gt;Create Date&lt;/span&gt; : &lt;strong&gt;'.$set['CreateDate'].'&lt;/strong&gt;&lt;br&gt;&lt;br&gt;';
  ?&gt;&lt;button id='addtab1' class='btn'&gt;Manage List&lt;/button&gt;&lt;?
  echo '&lt;p&gt;&lt;/p&gt;';
  }}
      ?&gt;
  &lt;div class="spacer"&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  
  &lt;br&gt;&lt;br&gt;&lt;br&gt;
  &lt;div id="stylized" class="myform"&gt;
  
  &lt;?
  // list out the public list
  try{
  $query = '
      SELECT *
      FROM     list
      Where IsPublic=1
  ';
  $stmt = $conn-&gt;prepare($query);
  $stmt-&gt;execute();
  $result= $stmt-&gt;fetchAll();
  $num_rows= $stmt-&gt;rowCount();
  }
  catch(PDOException $e)
      {
      die ($e-&gt;getMessage().'&lt;a href="add.php"&gt; Back&lt;/a&gt;'); 
      }
  $conn = null;
  if ($num_rows == 0) {
      echo '&lt;div style="text-align:center;font-weight:bold;"&gt;There are no public list.&lt;/div&gt;';}
  else {
      echo '&lt;h1&gt;Public Subscriber List&lt;/h1&gt; &lt;p&gt;There are '.$num_rows.' list(s).&lt;/p&gt;';
  foreach ($result as $set) 
  {
      try{
  $sql = '
      SELECT   ls.SubID
      FROM     list_sub ls,user_list ul
      WHERE    ul.UserID=?
      AND ls.ListID='.$set['ListID'].'
      AND ls.ListID=ul.ListID
  ';
  $stmt = $conn-&gt;prepare($sql);
  $stmt-&gt;execute(array($_SESSION['username']));
  $numSubs= $stmt-&gt;rowCount();
  }
  catch(PDOException $e)
      {
      die ($e-&gt;getMessage().'&lt;a href="add.php"&gt; Back&lt;/a&gt;'); 
      }
  
  echo '&lt;span class="label"&gt;List Name&lt;/span&gt; : &lt;strong&gt;'.$set['ListName'].'&lt;/strong&gt;&lt;br&gt;&lt;br&gt;';
  echo '&lt;span class="label"&gt;Number of subscriber&lt;/span&gt; : &lt;strong&gt;'.$numSubs.'&lt;/strong&gt;&lt;br&gt;&lt;br&gt;';
  echo '&lt;span class="label"&gt;Create Date&lt;/span&gt; : &lt;strong&gt;'.$set['CreateDate'].'&lt;/strong&gt;&lt;br&gt;&lt;br&gt;';
  echo "&lt;button id='addtab1' class='btn'&gt;Manage List&lt;/button&gt;";
  echo '&lt;p&gt;&lt;/p&gt;';
  
  }}
      ?&gt;
  &lt;div class="spacer"&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>