--
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 highlighting jQuery plugin. Each of the links will highlight the corresponding word. Remove highlights again. Download jquery.highlight-3.js (2 KB) and add it to your page after jQuery. A YUI compressed version (1 KB) is also available. Create an entry in your style sheet for the Call the The highlight can be removed from any element with the 轉自
highlight: JavaScript text higlighting jQuery plugin
Demo
Usage
Add highlight
Style the highlight class
highlight
class..highlight { background-color: yellow }
Highlight terms
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
removeHighlight
function. In this example, all highlights under the element with the ID highlight-plugin
are removed.$('#highlight-plugin').removeHighlight();
Changelog
- Aug 24 Tue 2010 11:07
[jQuery] HIGHLIGHT關鍵字
close
全站熱搜
留言列表