Skip to content
Related Articles
Open in App
Not now

Related Articles

jQuery UI Selectable tolerance Option

Improve Article
Save Article
  • Last Updated : 16 Jan, 2022
Improve Article
Save Article

jQuery UI consists of GUI widgets, visual effects, and themes implemented using the jQuery 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 tolerance option is used to determine which mode to use for testing whether the lasso should select an item. The lasso can refer to the element that is to be selected by dragging the box. It is of string type & its default value is “touch”.

The following are the possible values:

  • fit: It specifies when the lasso overlaps the item entirely.
  • touch: It specifies when the lasso overlaps the item by any specific amount.


Initialize selectable element with tolerance option:

$( "Selector" ).selectable({ tolerance: "fit" });
  • Get the default option:
    var tolerance = $( "Selector" ).selectable( "option", "tolerance" );
  • Set the default option:
    $( "Selector" ).selectable( "option", "tolerance", "fit" );

CDN Links: Below are some jQuery Mobile scripts that will be needed for your project so add these to your project.

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

Example: This example describes the uses of the jQuery Mobile Selectable tolerance Option.


<!doctype html>
<html lang="en">
    <link rel="stylesheet" href=
    <script src=
    <script src=
        h1 {
            color: green;
        #list .ui-selecting {
            background: greenyellow;
        #list .ui-selected {
            color: white;
            background: green;
        $(document).ready(function() {
            $("#Button").on('click', function() {
                var tolerance = $("#list").selectable(
                   "option", "tolerance");
        <h3>jQuery UI Selectable tolerance Option</h3>
        <ul id="list" style="list-style: none">
            <li>Data Structure</li>
        <input type="button" 
               value="Value of the tolerance option">
            <span id="gfg"></span>
        $(document).ready(function() {


jQuery UI Selectable tolerance Option


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!