This time I will share jQuery Plugin and tutorial about jQuery Plugin To Create Textarea With Line Numbering – LineNumbers, hope it will help you in programming stack.
Just another jQuery plugin that makes it easy to track the size of a textarea and display line numbers beside the typed content. It wraps lines intelligently, just because the textarea wraps doesn’t mean it’s actually a new line. Licensed under the GNU General Public License v3.0.
How to use it:
1. Download and put the jQuery LineNumbers plugin after you’ve loaded jQuery library like this:
1 |
< script src = "//code.jquery.com/jquery.min.js" ></ script > |
2 |
< script src = "jquery-linenumbers.js" ></ script > |
2. Just call the function on the target textarea
element and the plugin will do the rest.
1 |
$( 'textarea' ).linenumbers(); |
3. If you want to get fancy there are some additional options you can pass.
01 |
$( 'textarea' ).linenumbers({ |
4. You’ll need to give your text area a set width, or the two line numbers won’t line up right with the text, this has been tested as a px value, but percents should be ok in any format as long as the col_width is the same. Other than that it should work just fine.
8 |
border : 1px solid #aaaaaa ; |
Change log:
2017-09-22
This awesome jQuery plugin is developed by pgooch. For more Advanced Usages, please check the demo page or visit the official website.