# Drag and drop replace html

**URL:** <https://www.ruby-forum.com/t/drag-and-drop-replace-html/154167>\
**Category:** Rails\
**Created:** [November 26, 2008, 2:45am UTC](https://www.ruby-forum.com/t/drag-and-drop-replace-html/154167 "2008-11-26T02:45:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 26, 2008, 2:45am UTC](https://www.ruby-forum.com/t/drag-and-drop-replace-html/154167/1 "2008-11-26T02:45:44Z")

</div>

I have this:  
\<%= drop\_receiving\_element :slot2, {:onDrop =\> “function(element) {  
$(‘slot2’).replace(’

 + element + ’ ).addClassName  
(‘cardfill’); }”} %\>

I am trying to replace the data ina table but when I try this it  
complains a saying it is looking for a ‘}’ at “slot2”

According to the prototype docs this should be the correct syntax.  
Anyone know how to do this?

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 26, 2008, 7:27pm UTC](https://www.ruby-forum.com/t/drag-and-drop-replace-html/154167/2 "2008-11-26T19:27:04Z")

</div>

On Nov 26, 1:44 am, Me [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have this:  
> \<%= drop\_receiving\_element :slot2, {:onDrop =\> “function(element) {  
> $(‘slot2’).replace(‘ + element + ’ ).addClassName  
> (‘cardfill’); }”} %\>
> 
> I am trying to replace the data ina table but when I try this it  
> complains a saying it is looking for a ‘}’ at “slot2”
> 
> According to the prototype docs this should be the correct syntax.  
> Anyone know how to do this?

You need to escape those " in the string 🙂

Fred
