What’s New in jQuery UI 1.8

Share this article

When it comes to building interactive websites in the browser, there are few solutions as good as jQuery UI.  jQuery UI is a free library built on top on jQuery which provides an abstraction for low level interaction, advanced effects, animation as well as themeable widgets.  The current release is version 1.8.

This article will step you through the process of downloading and creating interactive web pages using jQuery UI 1.8.

Before You Begin

The jQuery UI library is made up of a number of components.  A component encapsulates a specific piece of functionality that is unique to the UI library.  Required components, known as the UI Core, are:

  • Core – the core of jQuery UI, required for all interactions and widgets
  • Widget – the widget factory, base for all widgets
  • Mouse – the mouse widget, a base class for all interactions and widgets with heavy mouse interaction
  • Position – a utility plugin for positioning elements relative to other elements

The components that allow the user to interact with the website are broken up into the following categories:

  • Interactions – these add basic behaviors to any element and are used by many components such as the Draggable and Sortable components
  • Widgets – full-featured UI Controls – each has a range of options and is fully themeable
  • Effects – a rich effect API and ready to use effects

The full list of components that are available can be found here.

Downloading Instructions

Downloading the jQuery UI library couldn’t be simpler.  Simply visit http://jqueryui.com/download, select the components and click Download to start the download.  Figure 1, “Downloading Your Components” displays this screen.

Figure 1.  Downloading Your Components
fig1

For this article I’m downloading all of the components.  Upon completion of the download, there’ll be one zip file with three folders that are included; css, development-bundle and js.  For the examples in this article, you’ll only need to extract the css and js folders.  All of the examples in this article use relative paths to these files.

What’s New in v1.8?

The current version of jQuery UI adds two new utilities, two new widgets, an upgraded widget factory and a more modular core.  Some of the more visible changes are outlined below.

Autocomplete Widget

The Autocomplete widget makes any text input pop up a menu to assist the user in completing a text entry or search box, or provide suggestions and improvements to search criteria they’re entering.  Autocomplete can be customized to work with various data sources.  This is configured by specifying the source option.  The data source can be an array of local data, such as an Array or Object, a URL which returns JSON data, or it can be retrieved from external data stores, such as a database, from the server via Ajax.

For the Autocomplete to work, you’ll need to reference the following JavaScript and CSS files in your page:

<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css" />

<script type="text/javascript" src="../../jquery-1.5.1.js"></script>

<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>

<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>

<script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>

<script type="text/javascript" src="../../ui/jquery.ui.autocomplete.js"></script>

The data source for this will be an array filled with programming languages.  The array will be set as the source for the Autocomplete:

$(function () {

        Autocomplete.Init();

});

var Autocomplete = function () {

    var languages = [

                "ActionScript", "AppleScript",

                "Asp", "BASIC",

                "C", "C++",

                "Clojure", "COBOL",

                "ColdFusion", "Erlang",

                "Fortran", "Groovy",

                "Haskell", "Java",

                "JavaScript", "Lisp",

                "Perl", "PHP",

                "Python", "Ruby",

                "Scala", "Scheme"

    ];

    return {

            Init: function () {

                $("#tags").autocomplete({

                    source: languages

                });

          }

    }

} ();

Figure 2, “Autocomplete Results” displays the end result.

Figure 2.  Autocomplete Results
fig2

There are a number of different options that are available to you that allow you to configure the behavior of the Autocomplete widget.  The main ones are:

disabled – allows you to either enable or disable the Autocomplete:

$("#tags").autocomplete({

                source: languages,

                disabled: true

});

delay – the delay in milliseconds the Autocomplete waits after a keystroke before activating itself:

$("#tags").autocomplete({

        source: languages,

        delay: 3000

});

minLength – the mininum number of characters a user has to type before the Autocomplete activates itself:

$("#tags").autocomplete({

        source: languages,

        minLength: 2

});

source – the data source to use for the Autocomplete.  Data sources include a URL that returns JSON data, a local object or JSON data returned via Ajax.  The following examples uses the free GeoNames database to remotely return results of a city:

$("#tags").autocomplete({

        minLength: 2,

        source: function (request, response) {

        $.ajax({

            url: "http://ws.geonames.org/searchJSON",

            dataType: "jsonp",

            data: {

                featureClass: "P",

                style: "full",

                maxRows: 5,

                name_startsWith: request.term

        },

        success: function (data) {

            response($.map(data.geonames, function (item) {

                return {

                        label: item.name + (item.adminName1 ? ", " +
                        item.adminName1 : "") + ", " + item.countryName,

                                 value: item.name

                }

            }));

        }

    });

}

Button Widget

The Button widget creates a themable button from any element on a page.  Traditionally buttons had an input type of submit, reset, image or button, but progressively developers are creating from elements such as anchor tags.  The Button widget makes this an attractive alternative for developers who want new styles to their website.

For the Button widget to work, you’ll need to reference the following JavaScript and CSS files in your page:

<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css" />

<script type="text/javascript" src="../../jquery-1.5.1.js"></script>

<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>

<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>

<script type="text/javascript" src="../../ui/jquery.ui.button.js"></script>

To transform an anchor element, you find the anchor and attach the Button widget to it.  Like this:

var anchor = $("a").button();

anchor.click(function () {

        alert('Hello');

});

<a href="#">My Anchor</a>

Figure 3, “Anchor as a Button” displays the end result:

Figure 3.  Anchor as a Button
fig3

Attached to the anchor is a click event.  You can pass in an anonymous function or a named function.  The Button widget can also transform radio buttons.  To transform radio buttons, call the buttonset function to do the work for you:

$("#radio").buttonset();

<div id="radio">

        <input type="radio" id="radio1" name="radio" /><label for="radio1">First</label>

        <input type="radio" id="radio2" name="radio" /><label for="radio2">Second</label>

        <input type="radio" id="radio3" name="radio" /><label for="radio3">Third</label>

</div>

Figure 4, “Radio Buttons Transformed” displays the end result:

Figure 4.  Radio Buttons Transformed

These are still radio buttons under the hood, so only one can be selected at anytime.  Check boxes can be transformed too by calling buttonset:

$("#format").buttonset();

<div id="format">

<input type="checkbox" id="check1" /><label for="check1">One</label>

         <input type="checkbox" id="check2" /><label for="check2">Two</label>

         <input type="checkbox" id="check3" /><label for="check3">Three</label>

</div>

Figure 5, “Check Boxes Transformed” displays the end result:

Figure 5.  Check Boxes Transformed
fig5

To find the checked elements, use regular jQuery:

$("#format input:checked").length;

What’s Changed in v1.8?

The current version of jQuery UI has also made updates to the core library.  Some of the more visible changes are outlined below:

jQuery UI Core is 71% smaller

The jQuery UI core has been reduced by 71%.  What this means to the developer is smaller payloads transferred to the client.  This will create an immediate increase in the website’s performance.

jQuery 1.5.1 Library

At the time of its release, jQuery UI shipped the latest version of jQuery which is 1.5.1.  This is not entirely clear when you visit the jQuery UI blog as it mentions an older jQuery version as being included.


Bug Fixes

As with any release, a large chunk of the release is dedicated to bug fixes.  The list of bug fixes is numerous and too large for this article.  A detailed report of all the bug fixes can be found here.

Summary

The jQuery team has worked hard on the jQuery UI library.  We’ve covered some of the new widgets and enhancements in this article.  What wasn’t covered was all of the other goodies that already exist in the jQuery UI library, such as the Dialog and Datepicker widget, as well as the Slider and Tabs widget.  This library is chockablock full of goodness.

If you’re beginning a greenfield project, or even inheriting a brownfield project, and you need to inject some brilliance in to your webpages, the jQuery UI library is for you.

Malcolm SheridanMalcolm Sheridan
View Author

Malcolm Sheridan is a Microsoft awarded MVP in ASP.NET, ASPInsider, Telerik Insider and a regular presenter at conferences and user groups throughout Australia and New Zealand. Follow him on twitter @malcolmsheridan.

jQuery
Share this article
Read Next
Cloud Native: How Ampere Is Improving Nightly Arm64 Builds
Cloud Native: How Ampere Is Improving Nightly Arm64 Builds
Dave NearyAaron Williams
How to Create Content in WordPress with AI
How to Create Content in WordPress with AI
Çağdaş Dağ
A Beginner’s Guide to Setting Up a Project in Laravel
A Beginner’s Guide to Setting Up a Project in Laravel
Claudio Ribeiro
Enhancing DevSecOps Workflows with Generative AI: A Comprehensive Guide
Enhancing DevSecOps Workflows with Generative AI: A Comprehensive Guide
Gitlab
Creating Fluid Typography with the CSS clamp() Function
Creating Fluid Typography with the CSS clamp() Function
Daine Mawer
Comparing Full Stack and Headless CMS Platforms
Comparing Full Stack and Headless CMS Platforms
Vultr
7 Easy Ways to Make a Magento 2 Website Faster
7 Easy Ways to Make a Magento 2 Website Faster
Konstantin Gerasimov
Powerful React Form Builders to Consider in 2024
Powerful React Form Builders to Consider in 2024
Femi Akinyemi
Quick Tip: How to Animate Text Gradients and Patterns in CSS
Quick Tip: How to Animate Text Gradients and Patterns in CSS
Ralph Mason
Sending Email Using Node.js
Sending Email Using Node.js
Craig Buckler
Creating a Navbar in React
Creating a Navbar in React
Vidura Senevirathne
A Complete Guide to CSS Logical Properties, with Cheat Sheet
A Complete Guide to CSS Logical Properties, with Cheat Sheet
Ralph Mason
Using JSON Web Tokens with Node.js
Using JSON Web Tokens with Node.js
Lakindu Hewawasam
How to Build a Simple Web Server with Node.js
How to Build a Simple Web Server with Node.js
Chameera Dulanga
Building a Digital Fortress: How to Strengthen DNS Against DDoS Attacks?
Building a Digital Fortress: How to Strengthen DNS Against DDoS Attacks?
Beloslava Petrova
Crafting Interactive Scatter Plots with Plotly
Crafting Interactive Scatter Plots with Plotly
Binara Prabhanga
GenAI: How to Reduce Cost with Prompt Compression Techniques
GenAI: How to Reduce Cost with Prompt Compression Techniques
Suvoraj Biswas
How to Use jQuery’s ajax() Function for Asynchronous HTTP Requests
How to Use jQuery’s ajax() Function for Asynchronous HTTP Requests
Aurelio De RosaMaria Antonietta Perna
Quick Tip: How to Align Column Rows with CSS Subgrid
Quick Tip: How to Align Column Rows with CSS Subgrid
Ralph Mason
15 Top Web Design Tools & Resources To Try in 2024
15 Top Web Design Tools & Resources To Try in 2024
SitePoint Sponsors
7 Simple Rules for Better Data Visualization
7 Simple Rules for Better Data Visualization
Mariia Merkulova
Cloudways Autonomous: Fully-Managed Scalable WordPress Hosting
Cloudways Autonomous: Fully-Managed Scalable WordPress Hosting
SitePoint Team
Best Programming Language for AI
Best Programming Language for AI
Lucero del Alba
Quick Tip: How to Add Gradient Effects and Patterns to Text
Quick Tip: How to Add Gradient Effects and Patterns to Text
Ralph Mason
Logging Made Easy: A Beginner’s Guide to Winston in Node.js
Logging Made Easy: A Beginner’s Guide to Winston in Node.js
Vultr
How to Optimize Website Content for Featured Snippets
How to Optimize Website Content for Featured Snippets
Dipen Visavadiya
Psychology and UX: Decoding the Science Behind User Clicks
Psychology and UX: Decoding the Science Behind User Clicks
Tanya Kumari
Build a Full-stack App with Node.js and htmx
Build a Full-stack App with Node.js and htmx
James Hibbard
Digital Transformation with AI: The Benefits and Challenges
Digital Transformation with AI: The Benefits and Challenges
Priyanka Prajapat
Quick Tip: Creating a Date Picker in React
Quick Tip: Creating a Date Picker in React
Dianne Pena
How to Create Interactive Animations Using React Spring
How to Create Interactive Animations Using React Spring
Yemi Ojedapo
10 Reasons to Love Google Docs
10 Reasons to Love Google Docs
Joshua KrausZain Zaidi
How to Use Magento 2 for International Ecommerce Success
How to Use Magento 2 for International Ecommerce Success
Mitul Patel
5 Exciting New JavaScript Features in 2024
5 Exciting New JavaScript Features in 2024
Olivia GibsonDarren Jones
Tools and Strategies for Efficient Web Project Management
Tools and Strategies for Efficient Web Project Management
Juliet Ofoegbu
Choosing the Best WordPress CRM Plugin for Your Business
Choosing the Best WordPress CRM Plugin for Your Business
Neve Wilkinson
ChatGPT Plugins for Marketing Success
ChatGPT Plugins for Marketing Success
Neil Jordan
Managing Static Files in Django: A Comprehensive Guide
Managing Static Files in Django: A Comprehensive Guide
Kabaki Antony
The Ultimate Guide to Choosing the Best React Website Builder
The Ultimate Guide to Choosing the Best React Website Builder
Dianne Pena
Exploring the Creative Power of CSS Filters and Blending
Exploring the Creative Power of CSS Filters and Blending
Joan Ayebola
How to Use WebSockets in Node.js to Create Real-time Apps
How to Use WebSockets in Node.js to Create Real-time Apps
Craig Buckler
Best Node.js Framework Choices for Modern App Development
Best Node.js Framework Choices for Modern App Development
Dianne Pena
SaaS Boilerplates: What They Are, And 10 of the Best
SaaS Boilerplates: What They Are, And 10 of the Best
Zain Zaidi
Understanding Cookies and Sessions in React
Understanding Cookies and Sessions in React
Blessing Ene Anyebe
Enhanced Internationalization (i18n) in Next.js 14
Enhanced Internationalization (i18n) in Next.js 14
Emmanuel Onyeyaforo
Essential React Native Performance Tips and Tricks
Essential React Native Performance Tips and Tricks
Shaik Mukthahar
How to Use Server-sent Events in Node.js
How to Use Server-sent Events in Node.js
Craig Buckler
Five Simple Ways to Boost a WooCommerce Site’s Performance
Five Simple Ways to Boost a WooCommerce Site’s Performance
Palash Ghosh
Elevate Your Online Store with Top WooCommerce Plugins
Elevate Your Online Store with Top WooCommerce Plugins
Dianne Pena
Unleash Your Website’s Potential: Top 5 SEO Tools of 2024
Unleash Your Website’s Potential: Top 5 SEO Tools of 2024
Dianne Pena
How to Build a Chat Interface using Gradio & Vultr Cloud GPU
How to Build a Chat Interface using Gradio & Vultr Cloud GPU
Vultr
Enhance Your React Apps with ShadCn Utilities and Components
Enhance Your React Apps with ShadCn Utilities and Components
David Jaja
10 Best Create React App Alternatives for Different Use Cases
10 Best Create React App Alternatives for Different Use Cases
Zain Zaidi
Control Lazy Load, Infinite Scroll and Animations in React
Control Lazy Load, Infinite Scroll and Animations in React
Blessing Ene Anyebe
Building a Research Assistant Tool with AI and JavaScript
Building a Research Assistant Tool with AI and JavaScript
Mahmud Adeleye
Understanding React useEffect
Understanding React useEffect
Dianne Pena
Web Design Trends to Watch in 2024
Web Design Trends to Watch in 2024
Juliet Ofoegbu
Building a 3D Card Flip Animation with CSS Houdini
Building a 3D Card Flip Animation with CSS Houdini
Fred Zugs
How to Use ChatGPT in an Unavailable Country
How to Use ChatGPT in an Unavailable Country
Dianne Pena
An Introduction to Node.js Multithreading
An Introduction to Node.js Multithreading
Craig Buckler
How to Boost WordPress Security and Protect Your SEO Ranking
How to Boost WordPress Security and Protect Your SEO Ranking
Jaya Iyer
Understanding How ChatGPT Maintains Context
Understanding How ChatGPT Maintains Context
Dianne Pena
Building Interactive Data Visualizations with D3.js and React
Building Interactive Data Visualizations with D3.js and React
Oluwabusayo Jacobs
JavaScript vs Python: Which One Should You Learn First?
JavaScript vs Python: Which One Should You Learn First?
Olivia GibsonDarren Jones
13 Best Books, Courses and Communities for Learning React
13 Best Books, Courses and Communities for Learning React
Zain Zaidi
5 jQuery.each() Function Examples
5 jQuery.each() Function Examples
Florian RapplJames Hibbard
Implementing User Authentication in React Apps with Appwrite
Implementing User Authentication in React Apps with Appwrite
Yemi Ojedapo
AI-Powered Search Engine With Milvus Vector Database on Vultr
AI-Powered Search Engine With Milvus Vector Database on Vultr
Vultr
Understanding Signals in Django
Understanding Signals in Django
Kabaki Antony
Why React Icons May Be the Only Icon Library You Need
Why React Icons May Be the Only Icon Library You Need
Zain Zaidi
View Transitions in Astro
View Transitions in Astro
Tamas Piros
Getting Started with Content Collections in Astro
Getting Started with Content Collections in Astro
Tamas Piros
What Does the Java Virtual Machine Do All Day?
What Does the Java Virtual Machine Do All Day?
Peter Kessler
Become a Freelance Web Developer on Fiverr: Ultimate Guide
Become a Freelance Web Developer on Fiverr: Ultimate Guide
Mayank Singh
Layouts in Astro
Layouts in Astro
Tamas Piros
.NET 8: Blazor Render Modes Explained
.NET 8: Blazor Render Modes Explained
Peter De Tender
Mastering Node CSV
Mastering Node CSV
Dianne Pena
A Beginner’s Guide to SvelteKit
A Beginner’s Guide to SvelteKit
Erik KückelheimSimon Holthausen
Brighten Up Your Astro Site with KwesForms and Rive
Brighten Up Your Astro Site with KwesForms and Rive
Paul Scanlon
Which Programming Language Should I Learn First in 2024?
Which Programming Language Should I Learn First in 2024?
Joel Falconer
Managing PHP Versions with Laravel Herd
Managing PHP Versions with Laravel Herd
Dianne Pena
Accelerating the Cloud: The Final Steps
Accelerating the Cloud: The Final Steps
Dave Neary
An Alphebetized List of MIME Types
An Alphebetized List of MIME Types
Dianne Pena
The Best PHP Frameworks for 2024
The Best PHP Frameworks for 2024
Claudio Ribeiro
11 Best WordPress Themes for Developers & Designers in 2024
11 Best WordPress Themes for Developers & Designers in 2024
SitePoint Sponsors
Top 10 Best WordPress AI Plugins of 2024
Top 10 Best WordPress AI Plugins of 2024
Dianne Pena
20+ Tools for Node.js Development in 2024
20+ Tools for Node.js Development in 2024
Dianne Pena
The Best Figma Plugins to Enhance Your Design Workflow in 2024
The Best Figma Plugins to Enhance Your Design Workflow in 2024
Dianne Pena
Harnessing the Power of Zenserp for Advanced Search Engine Parsing
Harnessing the Power of Zenserp for Advanced Search Engine Parsing
Christopher Collins
Build Your Own AI Tools in Python Using the OpenAI API
Build Your Own AI Tools in Python Using the OpenAI API
Zain Zaidi
The Best React Chart Libraries for Data Visualization in 2024
The Best React Chart Libraries for Data Visualization in 2024
Dianne Pena
7 Free AI Logo Generators to Get Started
7 Free AI Logo Generators to Get Started
Zain Zaidi
Turn Your Vue App into an Offline-ready Progressive Web App
Turn Your Vue App into an Offline-ready Progressive Web App
Imran Alam
Clean Architecture: Theming with Tailwind and CSS Variables
Clean Architecture: Theming with Tailwind and CSS Variables
Emmanuel Onyeyaforo
How to Analyze Large Text Datasets with LangChain and Python
How to Analyze Large Text Datasets with LangChain and Python
Matt Nikonorov
6 Techniques for Conditional Rendering in React, with Examples
6 Techniques for Conditional Rendering in React, with Examples
Yemi Ojedapo
Introducing STRICH: Barcode Scanning for Web Apps
Introducing STRICH: Barcode Scanning for Web Apps
Alex Suzuki
Using Nodemon and Watch in Node.js for Live Restarts
Using Nodemon and Watch in Node.js for Live Restarts
Craig Buckler
Task Automation and Debugging with AI-Powered Tools
Task Automation and Debugging with AI-Powered Tools
Timi Omoyeni
Quick Tip: Understanding React Tooltip
Quick Tip: Understanding React Tooltip
Dianne Pena
Get the freshest news and resources for developers, designers and digital creators in your inbox each week