3

I want to use JQuery in magento. When I included JQuery in the code, Prototype is throwing errors at this line.

element.attachEvent("ondataavailable", responder);

Can anyone help me?

0

1 Answer 1

3

This error is causing because Jquery and Prototype is getting conflict.You need to solve this conflict.

1) Create one js file called noConflict.js with the following content.

var jQuery = $.noConflict();

and include this file after your jquery.js

2) And you can use this jquery wih the following code

<script type="text/javascript">
    jQuery(document).ready(function(){
        // your code    
    });
</script>

P.S. for more information on solving jquery conflict refer http://magento-online-tutorials.blogspot.in/2015/10/how-to-solve-jquery-and-prototype.html

2
  • instead of creating a new file can't I add the $.noConflict(); in my code directly
    – Strikers
    Mar 12, 2015 at 7:13
  • yes u can add.... Mar 12, 2015 at 7:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.