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
on 2008-06-19 20:12
on 2008-06-19 20:17
$('DIVNAME').observe('click', function(){alert("HELLO")});
Just make sure you create the event AFTER the page has loaded.