jQuery error in Internet Explorer
I am calling a jQuery function as follows, where $.fn.myfunction = function(task) { ... }
is defined in the $(document).ready() { ... }
function.
$('#upd开发者_StackOverflowate').myFunction(task);
I'm getting the following error.
Object doesn't support this property or method
How do I fix this?
Looks like a capitalization error:
$('#update').myFunction(task);
// ^--- capital `F`
compared with
$.fn.myfunction = ...
// ^--- lower case `f`
JavaScript is case sensitive.
Other than that, I'm assuming you're calling $('#update').myFunction(task);
after setting up the function on $.fn
. If you fix the capitalization and ensure you're doing them in the right order, it should work fine.
Gratuitous live example
精彩评论