![]() |
VOOZH | about |
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 appendTo Option. This option allows us to find which element the draggable helper should be appended to while dragging. The default value of this option is "parent".
This option supports the following multiple types:
Syntax:
The appendTo option takes a above-defined type value and the syntax is as follows.
$( ".selector" ).draggable({ appendTo: "body" });
Get the appendTo option:
var appendTo = $( ".selector" ).draggable( "option", "appendTo" );
Set the appendTo option:
$( ".selector" ).draggable( "option", "appendTo", "body" );
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 = “https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css%E2%80%9D rel = “stylesheet”>
<script src = “https://code.jquery.com/jquery-1.10.2.js%E2%80%9D></script>
<script src = “https://code.jquery.com/ui/1.10.4/jquery-ui.js%E2%80%9D></script>
Example: This example describes the uses of the jQuery UI Draggable appendTo Option.
Output:
Reference: https://api.jqueryui.com/draggable/#option-appendTo