// Setup our tabs and cache the jQuery Object to be reused.
var $tabs = $("#tabs").tabs({
// tabTemplate: HTML template from which a new tab is created and added.
// The placeholders #{href} and #{label} are replaced with the
// url and tab label that are passed as arguments to
// the add method.
tabTemplate: "<li><a href='#{href}'>#{label}</a>\
<span class='ui-icon ui-icon-close'>Remove Tab</span></li>",
// add (event): This event is triggered when a tab is added.
add: function (event, ui) {
// Setup a tab based on a jQuery Template defined in the HTML.
$("#newProjectTabTemplate").tmpl()
// append the template results to the selected contents.
.appendTo(ui.panel)
// We need to recreate our To Do list accordions to setup the new
// accordion that was created with the new project tab.
.setupToDoList();
}
});
// Setup a click event to remove a tab from the tab bar.
$("#tabs span.ui-icon-close").live("click", function () {
// Remove (method): Remove a tab. The second argument is the zero-based
// index of the tab to be removed.
$tabs.tabs('remove', $(this).closest('li').index());
});
// Setup a dialog widget and cache the results so we can call it easily.
// This will ask the user for the name of the project.
var addProjectItem = $("#AddProjectItem").dialog({
// modal: If set to true, the dialog will have modal behavior; other items
// on the page will be disabled (i.e. cannot be interacted with). Modal
// dialogs create an overlay below the dialog but above
// other page elements.
modal: true,
// autoOpen: When autoOpen is true the dialog will open automatically when
// dialog is called. If false it will stay hidden until
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.