0
我有這個代碼,基於用戶輸入過濾表。但是,其刪除內容另一個表不同我的網頁上的標籤。我知道它導致問題的表選擇器。我試着調整「tr:not(:has(> th))」作爲我試圖過濾的特定表的ID和沒有運氣的add/remove類。我如何在沒有改變其他標籤內容的情況下讓這個功能正確運行於當前標籤頁/表格中?功能影響頁面上的多個選項卡 - jQuery的
userinp = $('#term').val();
$("tr:not(:has(>th))").each(function() {
if (~$(this).text().toLowerCase().indexOf(userinp.toLowerCase())) {
$(this).show();
} else {
$(this).hide();
}
});