highlight: JavaScript text higlighting jQuery plugin
Language/jQuery 2014. 11. 18. 13:42highlight: JavaScript text higlighting jQuery plugin
Posted 2007-09-15 in JavaScript by Johann.
Text higlighting is part of DynaCloud – where tags/keywords are automatically highlighted once they’re clicked – so I took that code and made it a stand-alone JavaScript text highlightingjQuery plugin.
Demo
Each of the links will highlight the corresponding word.
Remove highlights again.
Usage
Add highlight
Download jquery.highlight-4.js (2 KB) and add it to your page after jQuery. A Closure Compiler compressed version (1 KB) is also available.
Style the highlight class
Create an entry in your style sheet for the highlight
class.
.highlight { background-color: yellow }
Highlight terms
Call the highlight
function with the text to highlight. To highlight all occurrances of “bla” (case insensitive) in all li
elements, use the following code:
$('li').highlight('bla');
Remove highlighting
The highlight can be removed from any element with the removeHighlight
function. In this example, all highlights under the element with the ID highlight-plugin
are removed.
$('#highlight-plugin').removeHighlight();
출처 - http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html
'Language > jQuery' 카테고리의 다른 글
jQuery Multiple File Upload Plugin (0) | 2014.11.18 |
---|---|
jNotify jQuery Plug-in (0) | 2014.11.18 |
jquery.form.js (0) | 2014.11.18 |
jQuery-$.cookie 플러그인 사용법 (쿠키 활용편) (0) | 2014.11.18 |
jQuery UI datepicker 크기 조정 (0) | 2014.11.18 |