Magento News

 

Javascript: Don’t Use ‘length’ and ‘width’ as Variables

I have been working on a Magento customization that calculates rug pricing by square foot. I’ve had to write a good amount of javascript to help with this, and I had everything working just fine in Firefox, Safari, and Chrome. But (surprise, surprise) IE was throwing errors. After some console logging and debugging, I finally figured out that if I changed my variable names in a function I had from ‘length’ and ‘width’ to ‘rugLengh’ and ‘rugWidth’, then IE stopped complaining and everything worked just fine.

I’m not much of a javascript programmer, though I can get by. This particular issue is still a mystery to me. If any of you know why this was happening, I’d love to know!


Javascript: Don’t Use ‘length’ and ‘width’ as Variables

Possibly Related Posts:


 

Leave a Reply