Add Line Numbers To Texarea Element – ta-ln.js

Category: Form , Javascript | July 4, 2020
Author:TheCoolBlackCat
Views Total:1,916 views
Official Page:Go to website
Last Update:July 4, 2020
License:MIT

Preview:

Add Line Numbers To Texarea Element – ta-ln.js

Description:

ta-ln.js is a tiny (less than 1kb) JavaScript solution to add line numbers to the native <textarea /> element.

The line numbers will automatically increase or decrease with the size of the content you typed in the textarea.

How to use it:

1. Load the minified version of the ta-ln.js library at the end of the HTML page.

<script type="text/javascript" src="ta-ln.min.js"></script>

2. Add line numbers to the existing textarea element.

<textarea id="myInput"></textarea>
var input = document.getElementById("myInput");
LNPrefix(input);
input.addEventListener("input", LNPrefix.bind(this, input));

You Might Be Interested In:


Leave a Reply