Hi,
I want a select element that i change with javascript to fire a
''change'' event when i set it to a new value.
basically like this:
$(''someSelect'').selectedIndex = newValue;
$(''someSelect'').fire("change");
document.observe(''change'', function(){ alert("select
changed") });
When i change the select manually, the alert shows, when i change it
by code, it doesn''t.
When i use a custom event, like:
$(''someSelect'').fire("change:me");
document.observe("change:me", function(){...});
it all works..
but with default events like click, change etc, it doesn''t.
any thoughts on how to get this to work?
help appreciated, tnx
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Untested, but are they dom:change, dom:click, etc? You test "dom:loaded" when making sure the dom is loaded. Hmmm. Not sure. On 03/01/2008, CoolJazz <erikjanlam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, > > I want a select element that i change with javascript to fire a > ''change'' event when i set it to a new value. > > basically like this: > > > $(''someSelect'').selectedIndex = newValue; > $(''someSelect'').fire("change"); > document.observe(''change'', function(){ alert("select changed") }); > > > When i change the select manually, the alert shows, when i change it > by code, it doesn''t. > When i use a custom event, like: > > $(''someSelect'').fire("change:me"); > document.observe("change:me", function(){...}); > > it all works.. > but with default events like click, change etc, it doesn''t. > > any thoughts on how to get this to work? > > help appreciated, tnx > > > >-- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Firing native browser events is not yet supported. Best to fire the callback manually, or set your handler to listen for both a native event and a custom event. Cheers, Andrew On Jan 3, 9:08 am, CoolJazz <erikjan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I want a select element that i change with javascript to fire a > ''change'' event when i set it to a new value. > > basically like this: > > $(''someSelect'').selectedIndex = newValue; > $(''someSelect'').fire("change"); > document.observe(''change'', function(){ alert("select changed") }); > > When i change the select manually, the alert shows, when i change it > by code, it doesn''t. > When i use a custom event, like: > > $(''someSelect'').fire("change:me"); > document.observe("change:me", function(){...}); > > it all works.. > but with default events like click, change etc, it doesn''t. > > any thoughts on how to get this to work? > > help appreciated, tnx--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---