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.
Me (Guest)
on 2008-11-26 03: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?
Frederick C. (Guest)
on 2008-11-26 20:27
(Received via mailing list)
On Nov 26, 1:44 am, Me <removed_email_address@domain.invalid> 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.