MooTools interferes with jQuery?

1

Good morning.

My site uses jQuery, but I need to add a code that sends a confirm() to close the browser, but I realized that it only works with the library :

window.addEvent('load', function () {
    window.onbeforeunload = function (e) {
        e = e || window.event;

        // For IE and Firefox prior to version 4
        if (e) {
            e.returnValue = 'Any string';
        }

        // For Safari
        return 'Any string';
    };
});

Is it okay to add this library? Can it end up interfering with% d of%?

    
asked by anonymous 16.07.2015 / 15:04

1 answer

1

This line with MooTools code:

window.addEvent('load', function(){

In native JavaScript it will be

window.addEventListener('load', function(){

This line adds an event dropper to the window for when the page loads.

If it's just this line that needs MooTools then you can remove the library and use jQuery only. This is without disregard for the MooTools library with which I am myself involved, but in this specific case it is unnecessary.

Regarding possible conflicts between MooTools and jQuery I've already replied here.

    
16.07.2015 / 15:21