Uncaught TypeError: The '$' property of [object DOMWindow] is not a function
I get: Uncaught TypeError: the '$' property of the [object DOMWindow] object is not an error function in Chrome with my script.
<script type="text/javascript"> function showSlidingDiv() { $("#slidingDiv").fadeToggle("slow", "linear"); } function showSlidingDiv2() { $("#slidingDiv2").fadeToggle("slow", "linear"); } function showSlidingDiv3() { $("#slidingDiv3").fadeToggle("slow", "linear"); } </script> Does anyone know what could be wrong here?
Chrome loads other libraries that use the $ symbol for other purposes, so you need to use jquery without conflict. on the way - change $ character with jQuery
$(function(){...}); change to
jQuery(function(){...}); My assumption is that jquery was not loaded before running one of these methods, so it did not turn on before running these methods, or some error that prevented it from loading properly. Usually this should "just work" (at least not cause such an error message)
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> function showSlidingDiv() { $("#slidingDiv").fadeToggle("slow", "linear"); } function showSlidingDiv2() { $("#slidingDiv2").fadeToggle("slow", "linear"); } function showSlidingDiv3() { $("#slidingDiv3").fadeToggle("slow", "linear"); } </script> No time. I found a solution that worked for me.
Instead
$("#slidingDiv") to try
jQuery("#slidingDiv") other options were not helpful to me.
<script type="text/javascript"> var j = jQuery; function showSlidingDiv() { j("#slidingDiv").fadeToggle("slow", "linear"); } function showSlidingDiv2() { j("#slidingDiv2").fadeToggle("slow", "linear"); } function showSlidingDiv3() { j("#slidingDiv3").fadeToggle("slow", "linear"); } </script> make sure jQuery.noConflict () is not being called. Calling this will not allow the use of the abbreviated record $.