Bootstrap 5 - 搜索过滤器不显示 <a> 标签中的内容

问题描述 投票:0回答:0

我已经实施了一个 Bootstrap 5 页面搜索过滤器,但该过滤器仅显示文本内容,而不显示标签中包含的任何内容。链接到下面的 JS Fiddle:

https://jsfiddle.net/mfen723/rozy16pt/17/

我想让过滤器显示标签内的内容(因为它们出现在页面上)并保持链接可点击。

我实现的过滤函数是:

$(document).ready(function() {
$("#searchInput").on("keyup", function() {
  var value = $(this).val().toLowerCase();
  $("#research *").filter(function() {
    $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
  });
});

});

在此先感谢您的帮助。

search filter
© www.soinside.com 2019 - 2024. All rights reserved.