Magento 1.9 – Fix Uncaught TypeError: Cannot Read Property

javascriptmagento-1.9

That question is generic.

I can't understand because when i include a bit of javacript code, only for testing something in magento, the following error returns:

Uncaught TypeError: Cannot read property

Anyone could give me an exemple of how a testing code should be?

This is the code I tested:

$("a").removeAttr("href");

Best Answer

Magento use prototype.js framework. So if you want to use jQuery to read an element.

Use jQuery instead of $

jQuery('a').removeAttr('href');