jQuery插件DataTables:如何突出显示当前的搜索文本? [英] jQuery plugin DataTables: How to highlight the current search text?
本文介绍了jQuery插件DataTables:如何突出显示当前的搜索文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经开始将 DataTables 插件(v1.6.2)用于 jQuery (v1.4.2),我想问你是否知道 设置 或插件,可让我突出显示已过滤行中搜索文本框中使用的文字。
I have started using the DataTables plugin (v1.6.2) for jQuery(v1.4.2), and I would like to ask you if you know a settings or a plugin that allow me to highlight the text used in search textbox on the filtered rows.
提前谢谢
推荐答案
我不得不建议突出显示插件:)
我现在正在使用相同的场景,到目前为止我没有遇到任何问题。
I'm using this in about the same scenario right now, it's given me no issues thus far.
使用非常简单:
$("#myTable").highlight($("#searchBox").val());
只需将高亮CSS类放入样式表样式中就可以了,就是这样:
Just put the highlight CSS class in your stylesheet styles like you want and that's it:
.highlight { background-color: yellow }
这篇关于jQuery插件DataTables:如何突出显示当前的搜索文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文