/* A blog about frontend web development. */

Posts Tagged ‘Javascript’

jQuery Code Not Executing

January 5th, 2010

Recently I was working on some website that had an ajaxified section written by someone else. And there was a problem: javascript (using jQuery) on the page wasn’t working.

Except in IE7. And some of it in Firefox 3. But none of it in Chrome.

It’s always weird when something works in Internet Explorer and not, you know, a good browser. So what was going on? Many alert(‘asdf’);’s later I stumbled upon the reason:

jQuery and Prototype don’t work together.

Well, they both use ‘$’ as a shortcut for themselves. In my case, Prototype wasn’t even being used. It was just there first. Stealing the ‘$’ namespace.

My solution: goodbye Prototype.js! Or you can use the noConflict jQuery function.