Magento Forum

   
I not interpret well jquery functions
 
albertomgnt
Jr. Member
 
Total Posts:  15
Joined:  2012-07-09
 

Hello, I try to hide a div on the purchase of magento 1.7.0.1
I uploaded the extension of jquery 1.8.0.1 or similar load correctly and I at the top of the web.
When I try to call any jQuery function I get this error in the console and the function does not respond.

TypeError: $ (\"# div1\") is null
[Stop on this error]

$ (\’# div1\’). hide ();

I tried to put the ready, other functions that are not hidden, but always tells me the value is null

MOre thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
tzyganu
Mentor
 
Avatar
Total Posts:  2205
Joined:  2009-11-18
Bucharest, Romania
 

Magento uses prototype as js framework.
You can hide your div using prototype functions.

$ (’div1’).hide ();//if the id of your element is 'div1'
If you insist on using jQuery, add the noConflict statement http://api.jquery.com/jQuery.noConflict/

and in your code instead of $ use jQuery.
For example this:

$('#div1').hide()
//becomes
jQuery('#div1').hide();

Marius.

 
Magento Community Magento Community
Magento Community
Magento Community
 
MagikMahesh
Member
 
Total Posts:  36
Joined:  2012-04-10
 


This link can also help you, to use jquery
blog.magikcommerce.com/how-prototype-js-and-jquery-can-coexist-in-magento/


the above link gives a way to use jquery along with prototype.js in magento

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top