Mootools interfere with jQuery?

Asked

Viewed 21 times

1

Good morning.

My site uses jQuery, but I need to add a code that sends a confirm() to close the browser, however I realized that 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 there a problem with adding this library? May end up interfering with the jquery.min?

  • Can you add more code? more information about the problem? For information: Mootools and jQuery may coexist with some care.

  • No problem yet... I just want to know if the two libraries are together in the page script will have some interference in both? If they conflict. @Sergio

  • They can conflict, easy to solve. But if you add more code, I can help you use only one of them, since it is preferable to have only one. Otherwise this question is at the bottom of this: -> http://answall.com/q/769/129

  • It’s that I need a code that displays a confirm() when I want to close the browser, but I got this code that works with Mootools.

  • 1

    If that’s the only reason you can change the first line to window.addEventListener('load', function () { and you no longer need Mootools. Test.

  • 1

    uhuuuuuuuuuuuuuuu hehehe vlwww manooo kkk

Show 1 more comment

1 answer

1

This line with Mootools code:

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

in native Javascript will be

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

This line adds to the window an event receiver for when the page has loaded.

If it is only this line that you need from Mootools then you can remove the library and use only jQuery. This without contempt for the Mootools library with which I myself am involved, but in this particular case it is unnecessary.

Regarding possible conflicts between Mootools and jQuery I already answered about it here.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.