搜索狗的 alt 值与在搜索框中键入的值相同

Search divs for alt value the same as typed in searchbox

我有很多带有所有 alt 名称的 div,如果您在搜索框中键入内容,我只会用与搜索框键入的值相对应的 alt 值来显示 div。

我无法将 $('#kwd_search').val() 的搜索框输入值放入 ''[alt*= value ]。 任何人对如何修复它有建议吗?

fiddle.Source from: (Searching HTML Table [closed]) , (jQuery: If this HREF contains)

变化:

$(".child[alt*=(searchboxValue)]").show();

$(".child[alt*="+searchboxValue+"]").show();

https://jsfiddle.net/pleinx/md2zmdjs/2/

您将 searchboxValue 作为字符串而不是值,试试这个:

$(".child[alt*=" + searchboxValue + "]").show();

FIDDLE

检查这个。这有效。

$(".child[alt*=" + $(this).val() + "]").show()

https://jsfiddle.net/szxdtw5n/