Javascript Conflict?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
millsy007
Forum Commoner
Posts: 78
Joined: Wed Jul 02, 2008 7:00 pm

Javascript Conflict?

Post by millsy007 »

I have a webpage that uses some ajax to send an email form, this all works fine when this is the only javascript on my page.

It uses mootools.js and the following javascript:

Code: Select all

    <script type="text/javascript">
        window.addEvent('domready', function(){
            $('myForm').addEvent('submit', function(e) {
 
            new Event(e).stop();
            var log = $('log_res').empty().addClass('sending');
            this.send({
                update: log,
                onComplete: function() {
                    log.removeClass('sending');
                }
            });
            });     
        });
    </script>
But as soon as I reference other javascript (prototype, scriptalicious...) this code stops working.

Is this a conflict? Is there something I can do to handle this?
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: Javascript Conflict?

Post by jayshields »

I'm guessing it is a conflict because they will all probably use the $ character for the function. I know with jQuery you can redefine what character it is to stop conflicts. It's probably the same for the others.
Post Reply