Skip to content
Related Articles
Open in App
Not now

Related Articles

jQuery UI Selectable cancel Option

Improve Article
Save Article
  • Last Updated : 07 Dec, 2021
Improve Article
Save Article

jQuery UI consists of GUI widgets, visual effects, and themes implemented using Query JavaScript Library. jQuery UI is great for building UI interfaces for the webpages. It can be used to build highly interactive web applications or can be used to add widgets easily. 

The jQuery UI Selectable cancel option is used to prevent selecting from starting on the matching elements.


Initialize selectable element with cancel option:

    cancel: ".cancel"


Set or return cancel option after initialization:

// Set the cancel option
$( ".selector" ).selectable( 
    "option", "cancel", "a,.cancel" );

// Return the cancel option
var cancel = $( ".selector" )
    .selectable( "option", "cancel" );

CDN Link: First, add jQuery UI scripts needed for your project.

<link rel=”stylesheet” href=”//”>
<script src=”//”></script>
<script src=”//”></script>



<!doctype html>
<html lang="en">
    <meta charset="utf-8">
    <link rel="stylesheet" href=
    <script src="//"></script>
    <script src="//"></script>
        h1 {
            color: green;
        #list .ui-selecting {
            background: greenyellow;
        #list .ui-selected {
            background: green;
    <h3>jQuery UI Selectable cancel Option</h3>
    <ul id="list">
        <li>Data Structure</li>
        <li id="GFG1">HTML</li>
        <li id="GFG2">Bootstrap</li>
            cancel: "#GFG1, #GFG2"



My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!