开发者

jquery problem with selector

i have simple jquery code as below:

 $('.editImg').live('click', function (event) {
        var bb = $(this).closest("tr").find("label[title='lblAbonCodeMid']").text().trim();
     });

it works in 开发者_StackOverflowall browsers except ie 8 and ie 9. what i am doing wrond it says Object doesn't support this property or method


trim() is probably not supported in IE (as method of the String object (text() returns a string)). It is only part of ES5.

Try jQuery.trim():

$.trim($(this).closest("tr").find("label[title='lblAbonCodeMid']").text());


You should be using $.trim() in jQuery.

 $('.editImg').live('click', function (event) {
    var bb = $.trim($(this).closest("tr").find("label[title='lblAbonCodeMid']").text());
 });

String.trim() is part of the ECMAScript 5 standard.

Read trim

ECMAScript 5 compatibility table


There is no method trim() on Strings in IE. Use jQuery.trim() instead:

var bb = $.trim($(this).closest("tr").find("label[title='lblAbonCodeMid']").text());
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜