jQuery 插件 DataTables:如何突出显示当前搜索文本? [英] jQuery plugin DataTables: How to highlight the current search text?

查看:18
本文介绍了jQuery 插件 DataTables:如何突出显示当前搜索文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始使用 jQuery(v1.4.2) 的 DataTables 插件 (v1.6.2),我想问你是否知道 >settings插件 允许我在过滤的行上突出显示搜索文本框中使用的文本.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆