开发者

JQuery IE bind this

开发者 https://www.devze.com 2023-03-17 18:22 出处:网络
In IE I am getting this error in the console using JQuery: 开发者_开发知识库SCRIPT438: Object doesn\'t support property or method \'bind\'

In IE I am getting this error in the console using JQuery:

开发者_开发知识库SCRIPT438: Object doesn't support property or method 'bind' default.js, line 33 character 3

$.get(URL + 'dashboard/photoList/'+categoryID, (function(o) {
        // code here
}).bind(this));

Is there a work around to binding 'this'? I'm used to this from prototype.


bind is only available in browsers supporting ECMAScript 5. Unlike (apparently) Prototype.js, jQuery does not extend built-in objects.

jQuery offers $.proxy [docs]:

$.get(URL + 'dashboard/photoList/'+categoryID, $.proxy(function(o) {
        // code here
},this));
0

精彩评论

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