jQuery drag & drop works in html
Does jQuery drag & drop functionality work on HTML as well? I used button tags and used same drag & drop jQuery function to get it work. But unfortunately it does not work? Is it possible to call drag & drop functions for HTML buttons? I would be glad if you can help me. Here is the code that I used for that.
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>JSP Page</title>
- <script src="jquery-1.4.2.js"></script>
- <script src="jquery-ui.js"></script>
- <script>
- alert("inside script");
- $().ready(function() {
- alert("inside function");
- $("#draggable2").draggable({revert: "invalid"});
- $("#button2").draggable({revert: "invalid"});
- $("#textarea1").droppable({
-
- accept: function(d) {
- alert("droppable");
- if((d.attr("id")=="button2")){
- return true;
- }
- }
- });
- alert("after script");
- });
- </script>
- </head>
- <body>
- <h1>Hello World!</h1>
- <input type="button" value="Help" id="button2" disabled="disabled">
- <input id="submitme" type="submit" value="Send me your name!"><br>
- <button id="button1" value="Draggable Yellow" name="draggable">drag me</button>
- <textarea id="textarea1" rows="2" cols="20"></textarea
-
- <div id="draggable2">
- <p>Drag me around</p>
- </div>
- </body>
- </html>