UI widgets
UI widgets
Here’s an overview of the most common jQuery UI widgets and their usage:
1. Accordion Widget
The Accordion widget is used to display collapsible content panels in a stacked layout. Only one panel is expanded at a time.
<script>
$(function() {
$("#accordion").accordion();
});
</script>
</script>
2. Datepicker Widget
The Datepicker widget is used to create an interactive calendar that allows users to select a date from a popup calendar.
<script>
$(function() {
$("#datepicker").datepicker();
});
</script>
3. Spinner Widget
The Spinner widget provides a numeric input field with buttons to increase or decrease the value. It is useful for selecting numbers
within a range.
Example:
<input id="spinner" name="value" value="0">
<script>
$(function() {
$("#spinner").spinner();
});
</script>
4. Tabs Widget
The Tabs widget allows you to create tabbed navigation where each tab displays different content when selected. It is commonly
used to organize content on a page.
Example:
<div id="tabs">
<ul>
</ul>
<div id="tabs-1">
</div>
<div id="tabs-2">
</div>
<div id="tabs-3">
</div>
</div>
<script>
$(function() {
$("#tabs").tabs();
});
</script>
5. Progressbar Widget
The Progressbar widget allows you to create a visual progress indicator that shows how far a process has completed. It is often
used in file uploads or long-running processes.
Example:
<div id="progressbar"></div>
<script>
$(function() {
$("#progressbar").progressbar({
});
});
</script>
6. Slider Widget
The Slider widget creates an interactive range slider that allows the user to select a value within a specific range. You can use it for
things like adjusting volume, price range, etc.
Example:
<div id="slider"></div>
<script>
$(function() {
$("#slider").slider({
value: 37,
min: 0,
max: 100,
$("#amount").val(ui.value);
});
});
</script>
7. Tooltip Widget
The Tooltip widget is used to display additional information when a user hovers over an element. It can show small messages or
descriptions.
Example:
<button title="Click me for a surprise!">Hover over me!</button>
<script>
$(function() {
});
</script>
8. Selectable Widget
The Selectable widget makes a set of elements selectable by clicking or dragging, and it is often used in list boxes or grids.
<ul id="selectable">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
</ul>
<script>
$(function() {
$("#selectable").selectable();
});
</script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>