Forum: Ruby on Rails drag and drop replace html

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8133ee52ca72188132b5c7d97dfb967f?d=identicon&s=25 Me (Guest)
on 2008-11-26 02:45
(Received via mailing list)
I have this:
<%= drop_receiving_element :slot2, {:onDrop => "function(element) {
$('slot2').replace('<td id = "slot2"> + element + </td>' ).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?
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-11-26 19:27
(Received via mailing list)
On Nov 26, 1:44 am, Me <chabg...@gmail.com> wrote:
> I have this:
> <%= drop_receiving_element :slot2, {:onDrop => "function(element) {
> $('slot2').replace('<td id = "slot2"> + element + </td>' ).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
This topic is locked and can not be replied to.