# Question about Drag-and-Drop element

**URL:** <https://www.ruby-forum.com/t/question-about-drag-and-drop-element/195960>\
**Category:** Rails\
**Created:** [October 4, 2010, 4:35am UTC](https://www.ruby-forum.com/t/question-about-drag-and-drop-element/195960 "2010-10-04T04:35:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lambda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/5f9b8f/32.png) [@lambda](https://www.ruby-forum.com/u/lambda)\
**Post date:** [October 4, 2010, 4:35am UTC](https://www.ruby-forum.com/t/question-about-drag-and-drop-element/195960/1 "2010-10-04T04:35:31Z")

</div>

Hi,

I am testing the helper “drop\_receiving\_element” refer to the ROR book.  
the sample code like this :

\<%= drop\_receiving\_element(‘completed\_todos’,  
:accept =\> ‘pending\_todo’,  
:complete =\> “$(‘spinner’).hide();” ,  
:before =\> “$(‘spinner’).show();” ,  
:hoverclass =\> ‘hover’,  
:with =\> “‘todo=’ + encodeURIComponent(element.id.split(’\_’).last())” ,  
:url =\> {:action=\>:todo\_completed, :id=\>@user})%\>

When I test this code, it will block the following action(here is  
:todo\_completed). If you refresh the page, nothing changed. But when you  
drag the item, the effect looks like that item really be draged to  
another list and stay there.

If I removed the :complete and :before option, it will invoke the action  
as expect. But the item will go to its original location after drop.  
When I refresh the page, I can see the change.

What does $(‘spinner’).hide(); do in detail? I think the problem it  
something about “$(‘spinner’)”. Any idea will be appreciated

thanks  
Edwin
