
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
@netsells/highlight-within-textarea
Advanced tools
jQuery plugin for highlighting bits of text within a textarea.
jQuery plugin for highlighting bits of text within a textarea.
It's not actually possible to style text in a textarea, because any markup within a textarea is treated as literal text. This plugin aims to fake it, allowing you to highlight pieces of text inside a textarea.
A native textarea element is used and familiar behavior (auto-correct, scrolling, resizing, etc.) works as expected.
To start, call highlightWithinTextarea()
on a textarea, passing in a config object.
$('.my-textarea').highlightWithinTextarea({
highlight: whatever // string, regexp, array, function, or custom object
});
The highlight
property accepts several different types of values to describe what will be highlighted. You can see the various ways to highlight things, along with example code, on the demo page.
For reference, the demo page has some sample styling (view source to see the CSS).
There are some guidelines for getting your styles in the right places. Here are the classes you'll want to use.
Use for visibility, positioning, and background.
display
position
top
left
margin
background
Use for highlighted text. Generally, stuff that doesn't change size is fine.
background-color
border-radius
box-shadow
Changes to color
won't be visible, since text in the textarea covers colored text in the highlights.
Feel free to style your actual textarea
element as you like.
Highlighting will automatically be updated as the user edits the contents of the textarea. But sometimes other scripts may directly change the contents of the textarea. In these cases, you can manually trigger a highlighting update.
$('.my-textarea').highlightWithinTextarea('update');
You can remove the plugin from a textarea with this.
$('.my-textarea').highlightWithinTextarea('destroy');
FAQs
jQuery plugin for highlighting bits of text within a textarea.
The npm package @netsells/highlight-within-textarea receives a total of 29 weekly downloads. As such, @netsells/highlight-within-textarea popularity was classified as not popular.
We found that @netsells/highlight-within-textarea demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.