After extensive head banging, researching and searching through existing WP files, something finally presented itself. I had overlooked it earlier in the day, but lesson learned – I should have looked that one up immediately – jQuery’s noConflict function. It appeared in the js file being called right before my file and the first line read:
$j = jQuery.noConflict();
Basically what this function does is it removes the ability to use the $ variable. In jQuery, the $ is an alias for
jQuery. So for example, instead of writing
jQuery('p'), you could use the shortcut and write
$('p). But if noConflict() is called, you have to revert back to the long-hand. I had written my code using the alias.
Lesson learned? Look up everything as you come across it, especially when you’re still new to the language. This would have saved me hours, but at least I will never forget what to do when I run into the noConflict function. Alternatively, Nelson thinks that if I had called my file before the file calling noConflict, my code probably would have worked.