On Saturday 20 January 2007 16:20, RobG wrote:
> Michael Schuerig wrote:
> > Supposedly Prototype extends the HTMLFormElement.prototype so that
> > the following code ought to work
> >
> > $('myform').focusFirstElement()
>
> The function in Prototype.js should provide a hint:
>
> focusFirstElement: function(form) { ... }
>
>
> Which indicates it requires a form as an argument. Try:
>
> focusFirstElement('myform');
Nope. The functions in Form.Methods are mixed into
HTMLFormElement.prototype, where possible, otherwise they are added to
each form accessed through $('myform'). Therefore
$('myform').focusFirstElement()
does indeed work. That it didn't work for me originally was due to some
braindeadness on my part. Let's say when 'myform' is really the id of a
form element, then it does work at least in Firefox, Konqueror, and
IE7.
Michael
--
Michael Schuerig
mailto:[EMAIL PROTECTED]
http://www.schuerig.de/michael/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---