开发者

$ undefined error

开发者 https://www.devze.com 2023-02-09 07:01 出处:网络
I\'m developing a Chrome extension and I\'ve got the following... $(document).keypress(func开发者_运维百科tion(event){ resizeDialogIFrame(overlaydiv, iFrame.contentWindow); });

I'm developing a Chrome extension and I've got the following...

 $(document).keypress(func开发者_运维百科tion(event){ resizeDialogIFrame(overlaydiv, iFrame.contentWindow); });

But when executed I'm getting the following error...

Uncaught ReferenceError: $ is not defined

However, $('form[name="gs"]').attr('action'); is working fine elsewhere in the page.. What's going wrong?


If jQuery was loaded correctly (?) try this pattern to make sure $ references the jQuery object.

(function($) {
     $(function() {
         $(document).keypress(function(event){ resizeDialogIFrame(overlaydiv, iFrame.contentWindow); });
     });
}(jQuery));

If that doesn't help, check if jQuery was loaded correctly. Thatfore, call

alert('jQuery' in window);

if that alerts false, something is wrong.

0

精彩评论

暂无评论...
验证码 换一张
取 消