Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Title</title>
- <link rel="stylesheet" href="jquery-ui.css">
- <script src="jquery.js"></script>
- <script src="jquery-ui.js"></script>
- <style>
- ul{
- width: 250px;
- cursor: pointer;
- display: inline-block;
- list-style-type:none;
- vertical-align: top;
- }
- li{
- border:1px solid gray;
- margin-bottom: 5px;
- padding:5px;
- }
- .ui-selected{
- background-color: #b81900;
- }
- </style>
- </head>
- <body>
- <ul id="source" class="selected">
- <li>Item 1</li>
- <li>Item 2</li>
- <li>Item 3</li>
- <li>Item 4</li>
- <li>Item 5</li>
- <li>Item 6</li>
- <li>Item 7</li>
- </ul>
- <button id="add"> > </button>
- <button id="remove"> < </button>
- <ul id="dest" class="selectable">
- <li>Item 8</li>
- </ul>
- <script src="main.js">
- </script>
- </body>
- </html>
- $(document).ready(function (){
- $(".selected").selectable();
- $("#add").click(function (){
- $("#source").find(".ui-selected").appendTo("#dest").removeClass("ui-selected")
- })
- $("#remove").click(function (){
- $("#dest").find(".ui-selected").appendTo("#source").removeClass("ui-selected")
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment