开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜