script.aculo.us Sorting containment Option Last Updated : 05 Jan, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report The containment option in the Sorting elements module is used to enable sorting between two sortable. It takes an array of elements or element-id in which you want to enable sorting. Syntax: Sortable.create("element1_id", {containment: ["element1_id", "element2_id"]}); Sortable.create("element2_id", {containment: ["element1_id", "element2_id"]}); The examples below demonstrate this option: Example 1: HTML <!DOCTYPE html> <html> <head> <script type="text/javascript" src="./prototype.js"> </script> <script type="text/javascript" src="./scriptaculous.js"> </script> <script> window.onload = function () { Sortable.create("list1", { tag: "li", containment: ["list1", "list2"], }); Sortable.create("list2", { tag: "li", containment: ["list1", "list2"], }); }; </script> <style> li { cursor: move; } </style> </head> <body> <strong>List-1</strong> <ul id="list1"> <li>tag</li> <li>overlap</li> <li>constraint</li> <li>containment</li> <li>handle</li> </ul> <strong>List-2</strong> <ul id="list2"> <li>tag</li> <li>overlap</li> <li>constraint</li> <li>containment</li> <li>handle</li> </ul> </body> </html> Output: Example 2: HTML <!DOCTYPE html> <html> <head> <script type="text/javascript" src="./prototype.js"> </script> <script type="text/javascript" src="./scriptaculous.js"> </script> <script> window.onload = function () { Sortable.create("list1", { tag: "div", containment: ["list1", "list2"], }); Sortable.create("list2", { tag: "div", containment: ["list1", "list2"], }); }; </script> </head> <body> <strong>List-1</strong> <div id="list1"> <div><img src="gfg.png" /></div> <div><img src="g.jpeg" /></div> </div> <br /><br /> <strong>List-2</strong> <div id="list2"> <div><img src="g.jpeg" /></div> </div> </body> </html> Output: Comment More infoAdvertise with us Next Article script.aculo.us Sorting dropOnEmpty Option S swapnil074 Follow Improve Article Tags : Technical Scripter JavaScript Web Technologies Technical Scripter 2020 script.aculo.us +1 More Similar Reads script.aculo.us Sorting constraint Option The constraint option in the Sortable module is used to restrict the direction of movement of the elements while they are being dragged. It can either be set to 'horizontal' or 'vertical', thereby allowing movement in only that direction. Its default value is 'verticalâ. Syntax: Sortable.create('lis 1 min read script.aculo.us Sorting ghosting Option The ghosting option in the Sortable module is used to enable the user to make a semi-transparent copy of the element that is moved along with the mouse pointer. Its default value is 'falseâ, which means no copy is made. Syntax: Sortable.create('list', {ghosting: boolean}) The examples below demonstr 1 min read script.aculo.us Sorting dropOnEmpty Option The dropOnEmpy option in the Sortable module allows sortable elements to be dropped onto another list. Its default value is false. Syntax: Sortable.create(List1_id, {containment: [List1_id, List2_id], dropOnEmpty: true}); Sortable.create(List2_id, {containment: [List1_id, List2_id], dropOnEmpty: tru 1 min read script.aculo.us Sorting tag Option The tag option in the Sortable module is used to specify the type of elements that have to be made sortable in the container. Its default value is 'li', which is the list element. Syntax: Sortable.create( container_id, {tag: container_type} ); Example 1: HTML <!DOCTYPE html> <html> <h 1 min read script.aculo.us Sorting overlap Option The script.aculo.us library is a cross-browser library that aims at improving the user interface of a website. The sortable module can be used to make any list sortable, allowing the user to drag any item according to the order required. The overlap option is used to specify whether the item in the 3 min read script.aculo.us Sorting Elements Sortable provides the ability to user to create many draggable elements within the container. When you create a Sortable, it automatically creates the corresponding Draggable and Droppable for the container. Syntax:  Sortable.create('container_id', {options}); Sortable Options: OptionsDescriptionta 2 min read Like