om sai
om sai

Reputation: 63

Javascripts conflict in Joomla

my website name is marutiindia.in. I am using two extensions -- module and plugin. Module uses mootools(I think it is mootools---script_12.js) and the other employs jQuery. The module is on homepage. When I try to enable these both extensions I get this error in script_12.js

Uncaught TypeError: Object #<Object> has no method 'getElement'

but the the plugin works fine and when I disable this plugin there is no error. So I guess this is some conflict between mootools and jQuery. So I made use of this script for the plugin jQuery file:

if(jQuery){ 
  jQuery.noConflict(); 
}

But this doesn't resolve the error. Am I doing it right or is there something else I am missing.

Thanks.

Upvotes: 2

Views: 1355

Answers (2)

jogesh_pi
jogesh_pi

Reputation: 9782

only doing this

if(jQuery){ 
  jQuery.noConflict(); 
}

does not resolve your problem, if in the jquery module you have $ sign then the same conflict problem you will face.

To rid from this conflict try with this:

jQuery.noConflict()
jQuery(function(){
    //replace all the '$' with 'jQuery'
    jQuery('#some_id').show();
    //instead of
    //$('#some_id').show();
});

Upvotes: 2

idea34
idea34

Reputation: 723

Looks like you already have JQuery running. (K2 uses it, which may be the issue.) It is likely an script ordering issue like this. Also, do JQuery no conflict more like this

Upvotes: 0

Related Questions