Skip to content
Related Articles

Related Articles

jQuery UI Draggable zindex Option

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 26 Jan, 2022

jQuery UI  is a web-based technology and consists of GUI widgets, visual effects, and themes implemented using the jQuery, JavaScript Library. jQuery UI is the best tool for building UI interfaces for the webpages. It can also be used to build highly interactive web applications or can be used to add widgets easily.

In this article, we will learn how to use the jQuery UI Draggable zIndex Option. This option is used to set or get the Z-index for the helper while being dragged. The default value of this option is false.


The zIndex option takes a Number type value and the syntax is as follows:

$( ".selector" ).draggable({ zIndex: 100 });
  • Get the zIndex option:

    var zIndex = $( ".selector" ).draggable( "option", "zIndex" );
  • Set the zIndex option:

    $( ".selector" ).draggable( "option", "zIndex", 100 );

CDN Link: The following jQuery Mobile scripts will be needed for your project so we need to add these scripts to your project.

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

Example: This example describes the uses of the jQuery UI Draggable stack Option.


<!DOCTYPE html>
<html lang="en">
    <link rel="stylesheet"
    <script src=
    <script src=
        .dragg {
            width: 100px;
            height: 50px;
            border: 1px solid black;
            background-color: blue;
            width: 250px;
            height: 50px;
            border: 1px solid black;
            float: center;
            background-color: green;
            padding: 0.5;
            font-size: 20px;
            height: 40px;
            width: 40%;
        $(function () {
            $("#btn").on('click', function () {
                var zIndex = $(".dragg")
                    .draggable( "option", "zIndex" );
                   += "zIndex Value : " + zIndex;
        $(function () {
                zIndex: 100
                drop: function (event, ui) {
        <h1 style="color:green;">GeeksforGeeks</h1>
        <h3>jQuery UI Draggable zIndex Option</h3>
        <div class="dragg">
        <div class="dropp2">
            <p>Drop here</p>
        <input type="button" id="btn"
            value="Get zIndex">    
        <h3><span id="gfg"></span></h3>


jQuery UI Draggable zindex Option

jQuery UI Draggable stack Option


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!