I'm trying to display an alert on chrome using jQuery 1.3.2 as follows:
$(window).scroll(alert("Hello"));
It worked a few times, but then I received an error after five scrolls saying: TypeError: Object 100 has no method 'apply'
So I changed it to the following: $(window).scroll(function(){alert("Hello")});
But this does nothing at all whatsoever. I am testing this on Chrome. Could anyone let me know what I'm doing wrong?
The second code snippet you posted is the correct syntax for assigning a function to run on an event. That code works properly when I test it with a current version of jQuery. jQuery 1.3.2 is five years out of date, so I'd hazard a guess the issue is with the crazily old jQuery version you're trying to use.
Related
I made a post about this a while back and never got a firm fix for this, so excuse my double posting.
I've got a jQuery DataTable and I've got my dates in the second column in MM-DD-YYYY format. I'm trying to get my date range picker to work with it, so my datatable only shows rows with dates within the range in the picker.
Poultry in Motion kindly made the jsFiddle for me with my code and it is working perfectly there. Although on my website, it isn't working. I've tried the exact same scripts as the fiddle has. Except my jquery is a different version. Even when I switch it to 3.2.1 I still get the same error as with 1.12.4.
The error is:
Uncaught TypeError: Cannot read property 'apply' of undefined
at HTMLInputElement. (jquery-ui.min.js:9)
at Function.each (jquery-1.12.4.min.js:2)
What could my problem be?
You seem to be using a mismatched version of either jQuery or more likely jQueryUI. Switch the version on your website to be the exact same as in the working jsFiddle.
Moving to a newer version of the libraries that is not the same as the working jsFiddle version is not an acceptable fix, you need to match the exact version to debug this issue.
IE so much confusing me with some errors like this,
SCRIPT1002: Syntax error
File: jquery-2.1.4.min.js, Line:2 Column 2538
The weird thing is , on firefox and chrome running well and no error.
And some button with jquery click function is working.
I'm Using IE 11
Before this i'm using jquery-1.1.13.min.js and when i use jquery 2.0 it still running properly on firefox and chrome
I'm really new with cross browser so any info will helping me very much, thanks :)
For the record I had this error which only showed itself on IE when doing cross-browser testing of a big Javascript code change.
In my case the problem was a function definition which included what would be a default in any other language:
i.e. Function Foo(param1, param2, param3=false)
.. clearly this was a stupid bit of code .. but it took me a while to track down so this might help someone out there. Doesn't show up in Chrome, FF, or even Edge.
Mostly these errors are not problems of jQuery itself. The problem situates in code using jQuery or inserted into jQuery (callbacks or event functionalities). In my case I used $.ajax to load a remote page in a div element. In the page I loaded there where // comment tags in the javascript part. As IE is putting this content on one line, more code that as I wanted was commented and this created the error.
So if in our case us are using $.ajax maybe this can be an issue. Otherwise best thing to do is debugging the code that generates this error and look for code that is not supported by IE (the version you use). Look for functions passed trough to jQuery.
Hey guys out of no where I got this issue that came up on a wordpress site, no idea why. So let me tell you the issues:
Uncaught TypeError: Cannot read property 'msie' of undefined jquery.rating.pack.js:17 from jquery.rating.pack.js:17
Uncaught TypeError: Object [object Object] has no method 'live' from jquery.colorbox-min.js:4
So I have 2 plugins that stopped working because of this. I don't know if there was an update of some sort or where to even begin.
If you could give me a hand I would appreciate it.
Let me know if you need anything!
EDIT:
prodjsoundlighting.com - link to site with issue.
You have two jQuery scripts included on your website, you need to remove the one that is not from wordpress.
/wp-includes/js/jquery/jquery.js?ver=1.8.3
http://code.jquery.com/jquery-latest.min.js
What happens is all jQuery extensions (colorbox, rating pack) attach themselves on jquery object from first jquery script, then the second jquery script overwrites jquery object and you can't access any of the previously attached jquery extensions.
EDIT:
To avoid "$ is not a function" errors you will need to either replace all $ to jQuery
$(document).ready(function(){
will become
jQuery(document).ready(function(){
OR whats usually used, encapsulate your code with anonymous function like this:
(function($) {
// here goes your javascript code where you access jquery object will dollar sign
})(jQuery);
P.S. There is one quick fix you could use until you fix your code. Just use this in the same place where you had that other jquery call:
<script>var $ = jQuery;</script>
You should update to the latest version of Colorbox. Grab it here.
Old versions of Colorbox relied on .live(), which is a deprecated function (from 1.7+) and removed completely from jQuery 1.9+.
This is behavior is kind of strange.
In IE8 when I use $('something').is(':checked') to check if a checkbox is checked after setting it using $('something').attr('checked', true). I get an error when I run the script a second time.
I created a jsfiddle and the same issue occurs there.
After the following page loads, click run again. I get Object doesn't support this property or method in IE8
http://jsfiddle.net/Dxvmg/6/
Any ideas?
I am using jquery 1.6.2.
I think you've found a bug in jsfiddle. Seemed to work fine in a stand-alone web page.
I am using the jQuery Date Range Picker by the filament group.
My code is such that I'm dynamically creating a textbox or rather an AJAX query returns HTML of a form. When I dump the HTML onto my page I call a script that invokes the daterangepicker() function supposed to turn an inputbox into a date range picker.
My code works perfectly fine in Firefox and Internet Explorer, however it just dies in Google Chrome. The script doesn't run and I get this error in the logs:
Uncaught Error: INVALID_NODE_TYPE_ERR: DOM Range Exception 2
What could be the problem here? I really need to fix this - the exception is thrown within the core jQuery code. The date picker seems to work fine when I view the site demo.
You don't suppose it has something to do with being called to attach to an element that is created by an AJAX query at run time. Whatever the issue I need to get this working pronto and would appreciate any kind of help.
I had the same problem, and Chrome debugger notes the error is in the Jquery library version 1.3.2
I looked at the source for filaments daterangepicker demo page, and it turns out they are using jquery library 1.3.1
... src="js/jquery-1.3.1.min.js"
I ran a test using 1.3.1 instead of 1.3.2 and that worked for my site.
I recommend to test for browser and use 1.3.1 in the case that the user is using chrome.
All the Best,
Yehuda
several people report that this functionality is broken in Chrome. Maybe you should look out for alternatives.