开发者

jQuery error in Internet Explorer

开发者 https://www.devze.com 2023-03-22 18:33 出处:网络
I am calling a jQuery function as follows, where $.fn.myfunction = function(task) { ... } is defined in the $(document).ready() { ... } function.

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

精彩评论

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