$('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 <[EMAIL PROTECTED]> 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@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---