I''ve tried to create new options for select element via var el = new Element("option", { value : "value, text : "text here" }) it works fine for IE, but in Firefox text attribute of created option is empty. Just to let you know :) --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Hey Andriy, That would be because it needs an "innerHTML" property, IE compensates for this by just using the value in the "value" property. Also your example has a syntax error, there is no closing quote on "value". You could try this new Element("option", { value : "value", innerHTML : "Hi there" }) On Jul 25, 11:41 am, Andriy Mykhaylyuk <mehal....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''ve tried to create new options for select element via > var el = new Element("option", { > value : "value, > text : "text here" > }) > > it works fine for IE, but in Firefox text attribute of created option > is empty. > Just to let you know :)--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Hmm, I just finished working on dynamically building a select menu, when I decide to check the group. Anyway, I went with using the native Option constructor because it is a little simpler and probably faster. // new Option(text, value); var select = new Element(''select'', {name:''demo''}); select.options[select.length] = new Option(''one'', 1); select.options[select.length] = new Option(''two'', 2); select.options[select.length] = new Option(''three'', 3); --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
It''s just typing error, I has variable there :) innerHTML for option, it''s fun :) Thanx for reply, I haven''t looked into the code, I thought it is a bug. From documentation I''ve understand that this constructor evaluates every specified property as attribute of the object. On Jul 25, 10:49 pm, Matt <mattfoste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hey Andriy, > > That would be because it needs an "innerHTML" property, IE > compensates for this by just using the value in the "value" > property. > > Also your example has a syntax error, there is no closing quote on > "value". You could try this > > new Element("option", { > value : "value", > innerHTML : "Hi there" > }) > > On Jul 25, 11:41 am, Andriy Mykhaylyuk <mehal....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I''ve tried to create new options for select element via > > var el = new Element("option", { > > value : "value, > > text : "text here" > > }) > > > it works fine for IE, but in Firefox text attribute of created option > > is empty. > > Just to let you know :)--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I''ve tried innerHTML - works fine for Firefox and throws an exception in IE 7 On 7/25/07, Matt <mattfoster01-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Hey Andriy, > > That would be because it needs an "innerHTML" property, IE > compensates for this by just using the value in the "value" > property. > > Also your example has a syntax error, there is no closing quote on > "value". You could try this > > new Element("option", { > value : "value", > innerHTML : "Hi there" > }) > > > > > > > > On Jul 25, 11:41 am, Andriy Mykhaylyuk <mehal....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I''ve tried to create new options for select element via > > var el = new Element("option", { > > value : "value, > > text : "text here" > > }) > > > > it works fine for IE, but in Firefox text attribute of created option > > is empty. > > Just to let you know :) > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Also I''ve tried to use it to create new "h" elements and looks like when I''m passing innerHTML property to method it works fine for IE and for Firefox innerHTML is empty On Jul 25, 10:49 pm, Matt <mattfoste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hey Andriy, > > That would be because it needs an "innerHTML" property, IE > compensates for this by just using the value in the "value" > property. > > Also your example has a syntax error, there is no closing quote on > "value". You could try this > > new Element("option", { > value : "value", > innerHTML : "Hi there" > }) > > On Jul 25, 11:41 am, Andriy Mykhaylyuk <mehal....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I''ve tried to create new options for select element via > > var el = new Element("option", { > > value : "value, > > text : "text here" > > }) > > > it works fine for IE, but in Firefox text attribute of created option > > is empty. > > Just to let you know :)--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Use the update method for this: new Element(''option'', { value: ''blah''}).update(''text here''); Best, Thomas Am 26.07.2007 um 12:44 schrieb Andriy Mykhaylyuk:> > Also I''ve tried to use it to create new "h" elements and looks like > when I''m passing innerHTML property to method it works fine for IE and > for Firefox innerHTML is empty > > On Jul 25, 10:49 pm, Matt <mattfoste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> Hey Andriy, >> >> That would be because it needs an "innerHTML" property, IE >> compensates for this by just using the value in the "value" >> property. >> >> Also your example has a syntax error, there is no closing quote on >> "value". You could try this >> >> new Element("option", { >> value : "value", >> innerHTML : "Hi there" >> }) >> >> On Jul 25, 11:41 am, Andriy Mykhaylyuk <mehal....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> I''ve tried to create new options for select element via >>> var el = new Element("option", { >>> value : "value, >>> text : "text here" >>> }) >> >>> it works fine for IE, but in Firefox text attribute of created >>> option >>> is empty. >>> Just to let you know :) > > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---