When I load my page that uses jquery, I get the following error:
Uncaught TypeError: Cannot call method 'call' of undefined
jQuery.jQuery.fn.jQuery.ready test.html:282
(anonymous function) test.html:15
jQuery.jQuery.extend.ready
This is tracked down to
ready: function( fn ) {
// Attach the listeners
jQuery.bindReady();
// If the DOM is already ready
if ( jQuery.isReady ) {
// Execute the function immediately
fn.call( document, jQuery );
^^^^^^^^^^^^
// Otherwise, remember the function for later
} else if ( readyList ) {
// Add the function to the wait list
readyList.push( fn );
}
fn above is undefined... There is no other symptom I can see that points me to the problem. I am referencing a local copy of jquery.js.
<script src="js/jquery-1.4.4.js" type="text/javascript"></script>
Using the google cdn does not help either.. Cant imagine I'm the first person hitting this...
Anyone with poin开发者_运维百科ters to help a newbie?
thanks in advance, Jas
Looks like ready
is itself called without an argument (or with one that is undefined
).
what is it you're trying to initialize? generally anything that needs to be done on a page ready is done like:
$(document).ready(function(){
//your JS calls, functions, bindings, and whatever
});
I would guess that you have code somewhere in your page equivalent to:
$(document).ready(undefined);
You need to pass a function reference to the ready() method, as shown in FatherStorm's reply. If you are passing in a function name, ensure that the function is available in the scope that you are making the call to ready(). If you are defining the function inline, check for syntax problems or other errors on the page.
Recently I get the error:
Uncaught TypeError: Cannot call method 'call' of undefined
In my case, I removed one of my custom validator jQuery.validator.addMethod()
,
But I forgot to remove it from rules.
$("##frmCreate").validate({
rules: {
zip: {required: true, maxlength: 6, postalcode:true},
In above case, postalcode was my custom validator.
Hope it can help others..
精彩评论