jQuery Plugin To Limit Number Of Lines In Textarea - textareamaxrows

jQuery Plugin To Limit Number Of Lines In Textarea - textareamaxrows
File Size: 6.57 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

textareamaxrows is a simple textarea enhancement plugin which limits the maximum number of lines in a textarea element. Supports wordwrap, line counter and custom alert message.

How to use it:

1. Add jQuery JavaScript library and the jQuery textareamaxrows plugin to your webpage.

<script src="//code.jquery.com/jquery-1.12.1.min.js"></script>       
<script src="jquery.textareamaxrows.js"></script> 

2. Add a line counter next to your textarea element.

<span id="counter"></span> rows left

3. Call the textareamaxrows() method on the textarea element.

$('textarea').textareamaxrows({});

4. Default configuration options.

$('textarea').textareamaxrows({

  // displays alert message
  alert: false, 

  // custom alert message
  alertmessage : 'too many rows and chars', 

  // max rows
  maxrows : 20, 

  // max characters in row
  maxcharsinrow : 32,

  // displays row counter
  usecounter : false,

  // counter selector
  counterelem : '',

  // CSS class for error
  errorclass : 'error'            
  
});

This awesome jQuery plugin is developed by hubertusanton. For more Advanced Usages, please check the demo page or visit the official website.