First occurence only
$('textarea').highlightTextarea({
words: ['Lorem', 'ipsum'],
firstWord: true
});
Tag test
$('textarea').highlightTextarea({
words: [{
color: 'tag-hw',
words: ['HW']
}, {
color: 'tag-test',
words: ['Test']
}],
firstWord: true,
caseSensitive: false
});
Case insensitive
$('textarea').highlightTextarea({
words: ['lorem ipsum', 'VULPUTATE'],
caseSensitive: false
});
Resizable
$('textarea').highlightTextarea({
words: ['Lorem ipsum', 'vulputate'],
resizable: true
});
Regular Expression
$('textarea').highlightTextarea({
words: ['{(.+?)}']
});
Multiple colors
$('textarea').highlightTextarea({
words: [{
color: 'text-highlight-alt',
words: ['Lorem ipsum', 'vulputate']
}, {
color: 'text-highlight',
words: ['Donec']
}]
});
Indexes ranges
$('textarea').highlightTextarea({
ranges: [{
color: '#ADF0FF',
start: 0,
length: 10
}, {
color: '#FFFF00',
ranges: [[40,45], [50,55]]
}]
});
Customize highlight
<script>
$('textarea').highlightTextarea({
words: ['Lorem ipsum', 'vulputate'],
id: 'demoCustom'
});
</script>
<style>
#demoCustom mark {
padding:0 3px;
margin:-1px -4px;
border-radius:0.5em;
border:1px solid pink;
}
</style>