Skip to content
Related Articles

Related Articles

jQuery UI Draggable grid Option
  • Last Updated : 10 Mar, 2021

The jQuery UI consists of GUI widgets, visual effects, and themes implemented using jQuery, CSS, and HTML. jQuery UI is great for building UI interfaces for the webpages. The jQuery UI Draggable grid Option is used to set the dragging helper to a grid, every x, and y pixels. The grid value stored in form of array i.e. [x, y].


$( ".selector" ).draggable({
    grid: [x, y]

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 src=
        h1 {
            color: green;
        #div_element {
            width: 150px;
            height: 150px;
            background: green;
            display: flex;
            justify-content: center;
            align-items: center;
            text-align: center;
    <h3>jQuery UI Draggable grid Option</h3>
    <div id="div_element">Div content</div>
        $(function () {
                grid: [50, 30]



My Personal Notes arrow_drop_up
Recommended Articles
Page :