Update: I realized that my previous question was based on a mistake elsewhere.
Today, I decided to test my website on Opera after confirming its compatibility with Chrome and Firefox. I installed the latest version of Opera for Ubuntu and attempted to log in to my site. Unfortunately, I encountered some issues.
For some unknown reason, Opera is not recognizing any functions associated with the "submit" event of forms, particularly those related to validation. I have a standard
addEvent(element, eventtype, callback)
function that should work with both addEventListener
and attachEvent
.
Despite working seamlessly in Chrome and Firefox, when I tried:
addEvent(loginForm, 'submit', function(){alert("It works");});
I did not receive any response at all. It seems like the event is not being bound at all, rather than just preventing the default action as originally suspected. In relation to the example above, I can confirm that loginForm
does indeed reference the form element.
Does anyone have any insights into what might be happening with Opera?
Update: Here is the code block for my addEvent
function
function addEvent (obj, evt, callback) {
if (evt=="mousewheel")
evt = (/Firefox/i.test(navigator.userAgent))? "DOMMouseScroll" : "mousewheel"
if (obj.addEventListener){
obj.addEventListener(evt, callback, false);
} else {
obj.attachEvent("on" + evt, callback);
}
}