2

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");
2

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

Use jQuery instead of $

jQuery('a').removeAttr('href');
  • That's right I tested it and it worked perfect. Thank You Very Much – Diego Borba Jul 8 '15 at 19:17
  • For me, if i move attribute to attribute set i am getting error like snag.gy/Nmgn6p.jpg can u help me to get out this error? – Gem Oct 22 '18 at 6:24
1

Your issue is probably because $ is calling prototype and you are trying to access a property of a jQuery object. You should use a jQuery.noConflict() to prevent this kind of issues in the future. There are several guides to achieve this with different approaches, use the one you are more comfortable with.

  • Thanks a lot I'll find out more about what you said – Diego Borba Jul 8 '15 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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