javascript - TypeError: Property '$' of object [object Object] is not a function in jQuery 1.7.2 -
i seeing number of these errors in javascript error logs:
object expected
typeerror: property '$' of object [object object] not function
unfortunately, cannot replicate error on of these browsers when try myself. line have highlighted 1 causing error.
i have read bit "no conflict" mode , may problem here, can't see issue looking @ code below.
i using jquery 1.7.2 , served server, rather cdn:
<script type="text/javascript" src="/scripts/jquery/jquery-1.7.2.min.js"></script>
my code:
$(function() { $('.imgcell').live("mouseenter", function() { if($(this).find('a img').length > 1) { // line throws error $(this).find('a img:eq(0)').hide(); } }); });
it not appear affecting 1 specific browser either, following affected: chrome 26, chromium 25, firefox 10, firefox 14, firefox 16, firefox 20, ie 10, ie 8, ie 9, mobile safari 6
as of jquery 1.7, .live() method deprecated. use .on() attach event handlers.
$(document).on("mouseenter",'.imgcell', function() { //do });
if you're using cdn, need write fallback
<script type="text/javascript" src="//ajax.microsoft.com/ajax/jquery/jquery-1.9.2.min.js"></script> <script type="text/javascript"> if (typeof jquery == 'undefined') { // load js file if cdn failed document.write(unescape("%3cscript src='/js/jquery-1.9.2.min.js' type='text/javascript'%3e%3c/script%3e")); } </script>
Comments
Post a Comment