On Sun, Feb 20, 2011 at 20:39, kstubs <[email protected]> wrote:
> Well quite directly, is this illegal syntax:
> var div = $('#errordlg');
Not illegal _syntax_, but it will never find anything, since it asks
for an element
that has the id "#errordlt" - inluding the "#" charater in the id! I
don't think that's
even an allowed id value. (In JQuery that is however the right way to get
an element with the id "errordlg" (without the "#" character in the id.).
> Should it have been:
> var divs = $$('#errodlg');
> Which I understand, collect all elements who's ID is "errordlg"...
True. But since ids must be unique, that array will always have one
member (or none). I'm not sure what happens if you have more elements
with the same id - that's wrong anyway, so don't try it....
You could use this - in theory:
var div = $$('#errodlg')[0];
or
var div = $$('#errodlg').first();
or even
var div = $$('#errodlg').last(); // :)
Or will that throw an error if there is no element with that id? It's
unnecessary
anyway...
--
Bertilo Wennergren
[email protected] http://bertilow.com
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en.