Hey I have a form in my html body and I am trying to set an onclick
event for a button.
I have this code:
var acs_ref = Class.create({
initialize: function() {
Event.observe(''ref_del_id'',''click'',this.remover_url.bindAsEventListener(this));
},
remover_url:function() {
alert("Teste");
}
});
new acs_ref();
When I run this code I get a prototype error
element is null
[Break on this error] if (element._prototypeEventID) return
element._prototypeEventID[0];
This must be something related to it being a form element but I really
don''t know how to set events for the buttons I normally use links but
this time I have to use button forms.
Anyone know the correct way to set up this?
Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
$(''DIVNAME'').observe(''click'',
function(){alert("HELLO")});
Just make sure you create the event AFTER the page has loaded.
On Jun 19, 2:11 pm, AntonioCS
<Antoni...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hey I have a form in my html body and I am trying to set an onclick
> event for a button.
>
> I have this code:
>
> var acs_ref = Class.create({
> initialize: function() {
>
>
Event.observe(''ref_del_id'',''click'',this.remover_url.bindAsEventListener(this));
>
> },
> remover_url:function() {
> alert("Teste");
> }});
>
> new acs_ref();
>
> When I run this code I get a prototype error
>
> element is null
> [Break on this error] if (element._prototypeEventID) return
> element._prototypeEventID[0];
>
> This must be something related to it being a form element but I really
> don''t know how to set events for the buttons I normally use links
but
> this time I have to use button forms.
> Anyone know the correct way to set up this?
> Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Thanks :D I was making that mistake lol On Jun 19, 7:17 pm, Diodeus <diod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> $(''DIVNAME'').observe(''click'', function(){alert("HELLO")}); > > Just make sure you create the event AFTER the page has loaded. > > On Jun 19, 2:11 pm, AntonioCS <Antoni...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hey I have a form in my html body and I am trying to set an onclick > > event for a button. > > > I have this code: > > > var acs_ref = Class.create({ > > initialize: function() { > > > Event.observe(''ref_del_id'',''click'',this.remover_url.bindAsEventListener(this)); > > > }, > > remover_url:function() { > > alert("Teste"); > > }}); > > > new acs_ref(); > > > When I run this code I get a prototype error > > > element is null > > [Break on this error] if (element._prototypeEventID) return > > element._prototypeEventID[0]; > > > This must be something related to it being a form element but I really > > don''t know how to set events for the buttons I normally use links but > > this time I have to use button forms. > > Anyone know the correct way to set up this? > > Thanks--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---