JS error "Object expected" only on IE9

I am only getting an error on IE9 that the error says "SCRIPT5007: Object expected". There are two identical mistakes. One is in $ (document) at the start and the other is marked as "<- error here"

            var imagePath = "/sites/all/modules/custom/sixdegrees_right_menu/images/";

                var imgSrc = $(this).children(".menu-icon").find("img").attr("src");
                imgSrc = imgSrc.replace(imagePath, "");
                imgSrc = imagePath + "h-" + imgSrc;
                $(this).children(".menu-icon").find("img").attr("src", imgSrc);
                <- error here
                //$(this).children(".menu-title").children(".menu-name").children("img").animate({"left": "0px"}, "slow");
                //$(this).children(".menu-title").children(".menu-text").animate({"left": "0px"}, "slow");


There are also some commented lines that I don't have enough to remove if I can't state something.


source to share

1 answer

add type = "text / javascript" to your script tag and make sure you have successfully included jQuery before trying to use it.



All Articles