Hi miguels,
Please, find the following example which shows how to add new tab dynamically to jqxTabs. When you click on some tab the external page will be loaded.
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
<script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxtabs.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
<script type="text/javascript">
$(document).ready(function () {
// create jqxTabs.
$('#jqxTabs').jqxTabs({ height: 250, width: 500, showCloseButtons: true });
$('#jqxButton').jqxButton({
width: '200px',
height: 30,
});
$('#jqxButton').click(function () {
$('#jqxTabs').jqxTabs('addAt', 2, '<a href="pages/ajax3.htm">tabTitle</a>', '');
});
});
</script>
</head>
<body class='default'>
<div id='jqxWidget'>
<div id='jqxTabs' style="float: left;">
<ul style="margin-left: 30px;" id="unorderedList">
<li><a href="pages/ajax1.htm">ajax1</a></li>
<li><a href="pages/ajax2.htm">ajax2</a></li>
</ul>
<div>
</div>
<div>
</div>
</div>
<div style='margin-top: 10px;'>
<input type="button" id='jqxButton' value="Add new item item" />
</div>
</div>
</body>
</html>
If you want to show it in the tab content you should place the content in the div element.
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
<script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxtabs.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
<script type="text/javascript">
$(document).ready(function () {
// create jqxTabs.
$('#jqxTabs').jqxTabs({ height: 250, width: 500, showCloseButtons: true });
$("#1").load("pages/ajax1.htm");
$("#2").load("pages/ajax2.htm");
$('#jqxButton').jqxButton({
width: '200px',
height: 30,
});
var newContent = "<div id='3'></div>";
$('#jqxButton').click(function () {
$('#jqxTabs').jqxTabs('addAt', 0, 'tabTitle', newContent);
$("#3").load("pages/ajax3.htm");
});
});
</script>
</head>
<body class='default'>
<div id='jqxTabs' style="float: left;">
<ul style="margin-left: 30px;" id="unorderedList">
<li>Node.js</li>
<li>Active Server Pages</li>
</ul>
<div id="1"></div>
<div id="2"></div>
</div>
<input type="button" id='jqxButton' value="Add new item item" />
</body>
</html>
I hope the above examples will be helpful to you.
Best Regards,
Nadezhda
jQWidgets team
http://www.jqwidgets.com/