Forum: Rails Spinoffs (closed, excessive spam) .down with inputs named as array

Posted by louis w (Guest)
on 2008-06-13 19:14
(Received via mailing list)
Having problems using the down function to find inputs which have been
named as an array.

Example:
<form id="foo" ...>
    <input type="text" name="fields[title]"/>

prop = 'fields[title]';
$('foo').down('[name='+ prop +']');



This is related to this post
http://groups.google.com/group/rubyonrails-spinoff...
Posted by kangax (Guest)
on 2008-06-13 19:45
(Received via mailing list)
Wrap attribute value in quotes.
Also, it's a good idea to define variables local:

var prop = 'fields[title]';
$('foo').down('[name="'+ prop +'"]');

- kangax
Posted by louis w (Guest)
on 2008-06-16 23:18
(Received via mailing list)
This works. Thanks.
This topic is locked and can not be replied to.