I want some piece of code to delete the element dropped on the red div.I need the code to do the following:
- Create the clicked element on "Canvas" div.
- let the user drag the element
finally let the user delete the element by dropping it to red div. I hope I will get the best solution from here. here is the code:
function makeResizable(x) { x = $(x); x.resizable(); } function makeDraggable(x) { x = $(x); x.draggable(); } function createPredefine(){ $element = $(' <img src="img/5.jpg" alt="" height="45" width="110" onDblClick="makeResizable(this)" />'); $("#canvas").append($element); $element.draggable(); } $(document).ready(function(e) { $( "#deleting_div" ).droppable({ drop: function( event, ui ) { $(this).children().remove(); alert("trigger"); } }); });
Create Components
    <img src="img/5.jpg" alt="" height="45" width="110" onClick="createPredefine()"/>        <img src="img/6.jpg" alt="" height="60" width="80" onClick="createCircle()"/> <br /><br > </div> </td> <td> <div id="canvas" style="background- color:#FFF;width:800px;height:700px;"> <div id="deleting_div" style="background- color:red;widhth:50px;height:50px;"></div> <h2>                                      Draw Here</h2></div> </td> </tr> </table> </BODY> </HTML>