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

54c4985debe9ede54b95597ada6532fa?d=identicon&s=25 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...
F1fcf834ddad415f60d29c87cc10d4d4?d=identicon&s=25 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
54c4985debe9ede54b95597ada6532fa?d=identicon&s=25 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.