开发者

$ undefined error

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜