HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Tabs can be added easily by using jQuery EasyUI. You only need to call the 'add' method can be.
In this tutorial, we will use iframe dynamically add Tabs to display on a page. When you click the Add button, a new tab will be added. If the tab already exists, it will be activated.
<Div style = "margin-bottom: 10px"> <a href="#" class="easyui-linkbutton" onclick="addTab('google','https://www.google.com.hk/')"> google </a> <a href="#" class="easyui-linkbutton" onclick="addTab('jquery','/')"> jquery </a> <a href="#" class="easyui-linkbutton" onclick="addTab('easyui','http://jeasyui.com/')"> easyui </a> </ Div> <Div id = "tt" class = "easyui-tabs" style = "width: 400px; height: 250px;"> <Div title = "Home"> </ Div> </ Div>
The html code is very simple, we created the Tabs panel with a tab called 'Home''s. Please note that we do not need to write any js code.
function addTab (title, url) { if ($ ( '# tt'). tabs ( 'exists', title)) { $ ( '# Tt') tabs ( 'select', title).; } Else { var content = '<iframe scrolling = "auto" frameborder = "0" src = "' + url + '" style = "width: 100%; height: 100%;"> </ iframe>'; $ ( '# Tt'). Tabs ( 'add', { title: title, content: content, closable: true }); } }
We use 'exists' method to determine whether the tab already exists, if it exists activated tab. If there is no call to 'add' method to add a new tab panel.