A live JavaScript/jQuery example of jqxGantt, the jQWidgets Gantt component, with its complete source code below. It is one of 15 jqxGantt demos for jQuery.
source property – Determines the tasks that will be loaded inside the Timeline.dateEnd property – Determines a specific end date for the Timeline.dateStart property – Determines a specific starting date for the Timeline.tasks property – A getter that returns a flat structure as an array of all tasks inside the element.To run it in your own page, load jqx.base.css, a theme and the library files below from npm (npm install jqwidgets-scripts) or the jsDelivr CDN, then add the markup and the script. jQuery is not required: jqxcore.js provides $.
The page loads jqx.base.css, a theme and these library files: jqxcore.js, jqxgantt.js, jqxgantt.api.js.
It also loads helper scripts of this demo site, which are not part of the library: demos.js (getWidth() and other layout helpers).
window.onload = () => {
const gantt = new jqxGantt('#gantt', {
height: 'auto',
source: [
{
//Note: dateStart/dateEnd and min/max of syncronized projects are automatically calculated based on the tasks
label: 'Project 1',
synchronized: true,
expanded: true,
type: 'project',
connections: [
{
target: 1,
type: 0
}
],
tasks: [
{
label: 'Task 1.1',
dateStart: '2025-05-06',
dateEnd: '2026-04-06',
type: 'task',
connections: [
{
target: 2,
type: 2
}
]
},
{
label: 'Task 1.2',
dateStart: '2025-03-23',
dateEnd: '2026-06-06',
type: 'task'
},
{
label: 'Milestone 1',
dateEnd: '2026-03-11',
type: 'milestone',
connections: [
{
target: 4,
type: 1
}
]
}
]
},
{
label: 'Task 2',
dateStart: '2026-06-17',
dateEnd: '2026-12-06',
type: 'task'
}
]
});
};
<b>Description:</b> Connections can be created/removed using methods as well.
<ul>
<li>Add Connection - Create's a connection between "Task 1.2" and "Milestone 1" of type Start-to-Start(0).</li>
<li>Remove Specific Connection - Removes the selected connection from the Drop Down List.</li>
<li>
Remove All Connections - Removes all connections between the tasks.
</li>
</ul>
<div id="gantt"></div>
<div style="position: absolute; bottom: 5px; right: 5px;">
<a href="https://www.jqwidgets.com/" alt="https://www.jqwidgets.com/"><img alt="https://www.jqwidgets.com/" title="https://www.jqwidgets.com/" src="https://www.jqwidgets.com/wp-content/design/i/logo-jqwidgets.png"></a>
</div>