JQuery contains exact search

后端 未结 2 873
没有蜡笔的小新
没有蜡笔的小新 2021-01-15 06:40

I\'m using JQuery to parse some xml and having trouble with the line below:

$(xml).find(\"ACT:contains(\" + selectedAct + \")>SCENE\").each(function()
         


        
2条回答
  •  被撕碎了的回忆
    2021-01-15 07:08

    You could try extending the selectors... I made a demo in my blog a while back.

    $.extend($.expr[':'],{
    containsExact: function(a,i,m){
    return $.trim(a.innerHTML.toLowerCase()) === m[3].toLowerCase();
    },
    containsExactCase: function(a,i,m){
    return $.trim(a.innerHTML) === m[3];
    },
    containsRegex: function(a,i,m){
     var regreg =  /^\/((?:\\\/|[^\/])+)\/([mig]{0,3})$/,
      reg = regreg.exec(m[3]);
     return RegExp(reg[1], reg[2]).test($.trim(a.innerHTML));
    }
    });
    

提交回复
热议问题