Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display line number in textarea

I want to display the line number in a textarea like this is possible in jQuery:

enter image description here

I looked for answers on SO but I can't find what I want

Display current line and column number for a textarea

Limit number of lines in textarea and Display line count using jQuery

Also, the solution I tried from the JSFiddle provided from the comments show me the textarea like this:

enter image description here

which line 1234 is the first line and the second line is 5678

like image 630
aki Avatar asked Dec 08 '11 13:12

aki


1 Answers

Download the plugin found here: http://alan.blog-city.com/jquerylinedtextarea.htm

Usage:

$(function() {

  // Target all classed with ".lined"
  $(".lined").linedtextarea(
    {selectedLine: 1}
  );

  // Target a single one
  $("#mytextarea").linedtextarea();

});

Fully functional demo: http://files.aw20.net/jquery-linedtextarea/jquery-linedtextarea.html (web.archive)

like image 66
James Hill Avatar answered Sep 28 '22 04:09

James Hill