How to Drop Content using JQuery

This sample demonstrates how to drop content in target location on page using JQuery in web application.

Getting Started

Creating a ASP.NET Application:

  • Open Visual Studio 2010.
  • Go to File => New => Web Site.
  • Select ASP.NET Web Site from the Installed templates
  • Enter the Name and choose the location.
  • Click OK.


Call .js and .css file inside of page head tag.

        <title>jQuery Droppable Sample</title>
        #draggable{ width: 100px; height: 100px; padding: 0.5em; float: left; margin: 10px10px10px0; }
        #droppable{ width: 150px; height: 150px; padding: 0.5em; float: left; margin: 10px; }        </style>
            $(function () {
        drop: function (event, ui) {

Now put this code inside of form tag.

divid="draggable"class="ui-widget-content"style="border: thin solid red;">
        <p>Drag me to my target</p>

style="border: thin solid #008000; background-color: #FFFFFF">
        <p>Drop here</p>


Build and run the application to see the result.


Image 1.

This is the result when we drop the content in target location.


Image 2.

We are done here, if question or comments drop me a line in comments section.