Line Number Textarea Using jQuery

Learn How to create line number on textarea using jquery

 

IMPORT LIBRARIES
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="jquery-linedtextarea.js"></script>
<link href="jquery-linedtextarea.css" type="text/css" rel="stylesheet" />

 

JAVASCRIPT CODE
$(function() {
  // Target all classed with ".lined"
  $(".lined").linedtextarea(
    {selectedLine: 1}
  );
  // Target a single one
  	$("#mytextarea").linedtextarea();
});

 

HTML CODE
<textarea class="lined" rows="20" cols="60">
your text on textarea
</textarea>

 

Leave a Reply

Your email address will not be published. Required fields are marked *