resize javascript error in chrome - javascript

$(window).on('resize', function(){
self.setDimensions();
});
Uncaught TypeError: Object # has no method 'on'
Why is only google chrome throwing this error?
and how can I fix it?

No need to use event delegation (on) here. Just bind the resize event directly to the window:
$(window).resize(function () {
self.setDimensions();
});
I could replicate your error when using an older version of jQuery (1.6.4).
Working (1.8.2)
Working (1.7.2)
Not Working (1.6.4)
Try to make sure you're using a recent version of jQuery and not an older, perhaps cached version.

Related

JQuery version 1.11.0 Load Error in Safari 5.1.7 for Windows

I have got the below error when loading in Safari 5.1.7 for windows.
The error is as below:
TypeError: 'undefined' is not a function (evaluating 'div.cloneNode( true ).click()')
When drill deeper down to jquery 1.11.0 source code, it was pointing to the code below in bold:
// IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
support.noCloneEvent = true;
if ( div.attachEvent ) {
div.attachEvent( "onclick", function() {
support.noCloneEvent = false;
});
**div.cloneNode( true ).click();**
}
I am using ASP.NET MVC 5.2. It seems that the JQuery failed to be loaded in Safari.
Any idea on why? Thanks!
This is weird. This error only happened in Safari 5.1.7 for Windows.
For some reason, I need to put JQuery script before other scripts even though that other scripts do not use JQuery.
This is resolved by putting JQuery script on top before other scripts.
Thanks.
I have the same problem, but I resolved with simulate.
Sample:
// Triggering a native browser event using the simulate plugin
$( "a" ).simulate( "click" );
Simulate events to help unit test user interactions. I try putting JQuery script on top, but not work for me.

bind is not working in safari 5.1.1

I'm using safari 5.1.1 in my system and my application is also running in safari 5.1.1. In my application i'm using window resize event with bind method. Its working fine all other browsers like ie, chrome,firefox but it doesn't work in safari 5.1.1 and less. whenever its run it will through an exception as '"undefined" is not a function({....}.bind(this);...'.
I have searched more about this issue but i din't found any solutions to recover this issue.
$(window).resize(function () {
alert("resized");
...My code goes 'this' here....
}.bind(this));
Is there any way to resolve this issue?
Thanks,
KarthiK
The error most likely comes from .bind(this). As you see in the MDN docs about Function.prototype.bind, safari supports bind in versions >= 5.1.4.
You can use jQuery.proxy instead.
var resizeHandler = function() { alert('resized'); };
$(window).resize($.proxy(resizeHandler, this));
Did not test the example but it should look like this.

IE 10 keyup/keydown not firing with jQuery 1.10.1

Using jQuery 1.10.1, for some reason this isn't working in IE10 but works fine everywhere else (read Chrome, Firefox). Discovered this bug while creating a fiddle for an answer on Stack Overflow.
HTML
<input type="text" id="anId" />
jQuery
$(function(){
$("#anId").keyup(function(){
alert(1);
});
});
Neither does this:
$(function(){
$("#anId").keydown(function(){
alert(1);
});
});
FIDDLE
FIDDLE
This is a bug in JQuery 1.10.1. You should be seeing a security error in your console on IE. This is fixed in JQuery 1.10.2.
See this jquery bug:
http://bugs.jquery.com/ticket/13980
From the bug:
In IFrame where the content is loaded from the external domain, JQuery v1.10.1 fails to load in Opera 12.15 and IE 10 with error "Unhandled error: Security error: attempted to read protected variable" on the line 1513.

Why can't I make jQuery UI 1.8.20 dialog work in JSFiddle?

I'm trying to use jQuery UI dialog in JSFiddle, but opening the dialog fails consistently due to an error deep in the innards of jQuery UI: Uncaught TypeError: Cannot read property '3' of undefined.
I'm using jQuery UI 1.8.20, but I've found that if I switch to for example 1.7.1, it works fine. I've created a fiddle that should demonstrate the problem, just click the button saying 'Click me!' and you should see in your browser's console (e.g. in Chrome's developer tools) that a TypeError has been raised by jQuery UI.
What is going wrong here? Am I seeing some incompatibility between jQuery UI 1.8.20 and JSFiddle?
There is an incompatibility between jQuery 1.8.0 and jQuery UI 1.8.20. Upgrading to jQuery UI 1.8.22 solves it.

jquery 1.7 "on" method IE8 crashes mshtml.dll

As mentioned I'm using latest version of jQuery.
I simply call
$('table').on('click', 'tr', function() {
alert('click');
});
It runs well on every browser except IE8 (not tested on IE7).
Note I'm running Windows on Parallels Desktop on my iMac.
The crash has something to do with mshtml.dll as reported by IE8 Crash dialog box.
Any advice?
Check the jsFiddle here: http://jsfiddle.net/powtac/kuht6/4/
is working fine here something else could be wrong
http://jsfiddle.net/5Hhmg/

Categories