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.
精彩评论