Try It Editor
Tip: Press
Ctrl/⌘ + Enter
to Run
▶ Run
Reset
Copy
Download
Code
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>jQuery UI - First Widget Taste</title> <link rel="stylesheet" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script> <style> body{font-family:Arial, sans-serif; padding:20px;} #dragBox{width:140px;height:80px;background:#04AA6D;color:#fff;display:flex;align-items:center;justify-content:center;border-radius:6px;cursor:move;margin-bottom:20px;} #dateInput{padding:6px 10px;border:1px solid #ccc;border-radius:4px;width:200px;} </style> </head> <body> <h3>Draggable box</h3> <div id="dragBox">Drag me</div> <h3>Datepicker input</h3> <label for="dateInput">Pick a date: </label> <input type="text" id="dateInput" placeholder="Click to open calendar"> <script> $(document).ready(function(){ $("#dragBox").draggable(); $("#dateInput").datepicker(); }); </script> </body> </html>
Output