jQuery contains 如何用于选择精确的字符串?
这是一个工作代码,用于设置包含字符串树的每个表行中的行颜色。
$( "#AnsprechpartnerTabelle tr:contains('" + x + "')").css( "background-color", "red" );
问题是内容为“treeapple”的行也被选中。
那么它如何才能像用户故事一样工作呢?
最佳答案
用途:
$("#AnsprechpartnerTabelle tr").filter(function() {
return $(this).text() === x;
}).css( "background-color", "red" );
关于javascript - 如何使用 JQuery contains 获取精确字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21528728/