How do you escape parentheses in jQuery selector?

后端 未结 3 488
天涯浪人
天涯浪人 2020-12-06 11:07

I am trying to check if a td innertext contains parentheses (). The reason is I display negative numbers as (1000) and I need to convert them to -1000 to do math. I\'ve trie

3条回答
  •  鱼传尺愫
    2020-12-06 12:03

    I think you'll have to use a filter function like:

    $('#fscaTotals td *').filter(function(i, el) {
        return !!$(el).text().match(/\(/);
    });
    

    Edit: I think this is a bug in jQuery's :contains().

提交回复
热议问题