Harsha Venkataramu
Harsha Venkataramu

Reputation: 2914

Unable to detect droppable event on body using jquery UI

I am creating to create drag and drop functionality using jquery UI. However , the drop event isn't getting triggered when I drop something on the body

Here is my demo code.Any help will be appreciated.

http://jsfiddle.net/ysptW/1/

Upvotes: 0

Views: 499

Answers (2)

markpsmith
markpsmith

Reputation: 4918

Change

 $( "body" ).droppable({

to:

 $( "#droppable" ).droppable({

Here is the jsFiddle

UPDATE

You almost had it, the problem was that your body didn't have a height, which was identified by giving it a css border. Once a height was set using body{height:200px;} then it worked.

new jsFiddle in response to comments:

Upvotes: 1

Anubhav Ranjan
Anubhav Ranjan

Reputation: 1598

Update your code from

$("body").droppable

to

$("#droppable").droppable...

You can check the same at http://jsfiddle.net/anubhavranjan/yEvsY/

For more info, visit http://jqueryui.com/droppable

Upvotes: 0

Related Questions