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 String
s in IE. Use jQuery.trim()
instead:
var bb = $.trim($(this).closest("tr").find("label[title='lblAbonCodeMid']").text());
精彩评论