Reputation: 31
This is my code:
function loadOffer(id) {
window.open("http://www.google.com.com","mywindow");
}
It's initiated onClick. However I get the following error:
Uncaught TypeError: Property 'open' of object [object DOMWindow] is not a function
Any ideas?
Upvotes: 3
Views: 5082
Reputation: 11
found this at http://drupal.org/node/1003664
wrap your code in this
(function ($) {
// All your code here
})(jQuery);
Upvotes: 1
Reputation: 55678
Under normal circumstances, window.open
is a function. So you've probably changed it somewhere else in the code, most likely by defining a variable open
without a var
statement.
> window.open
function open() { [native code] }
> open = "test"
"test"
> window.open
"test"
Upvotes: 1
Reputation: 45545
You've defined a global variable somewhere called open
and it's not a function. It's overridden the normal function of window.open
.
Yet another good reason to namespace our javascripts.
Upvotes: 7