开发者

using JQuery to convert html tr tags to uppercase for string comparison

I have the following JS function:

function tblFilter(colToFilter) {
var tableToFilter = $("#notesGrid").find("tr");
var columnToFilter = colToFilter;

$.each(columnToFilter, function (i) {
    tableToFilter = tableToFilter.filter(":contains'" + columnToFilter + "')");
});

tableToFilter.show();

};

colToFilter is uppercase and I want to convert what I am comparing to to uppercase as well to ensure case insensitivity.

I have tried this:

function tblFilter(colToFilter) {
    var tableToFilter = $("#notesGrid").find("tr");
    var columnToFilter = colToFilter;

    $.each(columnToFilter, function (i) {
        tableToFilter = tableToFilter[i].innerHTML.toUpperCase().filter(":contains'" + columnToFilter + "')");
 开发者_如何学Go   });

    tableToFilter.show();

};

However it fails saying:

Microsoft JScript runtime error: Object doesn't support this property or method


Try to use match() method of strings.


Can you have a try with the following?

$(tableToFilter[i].innerHTML.toUpperCase()).filter()
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜