Skip to content
This repository has been archived by the owner on Nov 28, 2017. It is now read-only.
/ jquery-limitwords Public archive

jQuery plugin that limits the number of words in a form element.

Notifications You must be signed in to change notification settings

jom/jquery-limitwords

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

/*
 * jQuery limitWords Plugin
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the copyright notice.
 *
 * @copyright		Copyright 2010 Jacob Morrison <jomorrison gmail com>, http://projects.ofjacob.com
 * @license			http://www.opensource.org/licenses/mit-license.php The MIT License
 * @author			Jacob Morrison <jomorrison gmail com>
*/

Basic Usage for <textarea id="myTextarea"></textarea> element:

$("#myTextarea").limitWords();

Options
=================================
	leftSelector: 		element you want to have updated with the number of words left (default: false)
	limit:				number of words you want to allow (default: 250)
	underColor:			when leftSelector is set, color to set when input is under the limit (default: green)
	atColor:			when leftSelector is set, color to set when input is at the limit (default: orange)

Example with Counter Element
=================================

(in body somewhere)
<textarea id="myTextarea"></textarea> (Word limit: 100, <span id="myTextarea_left"></span>)

(in head)
<script type="text/javascript"> 
//<![CDATA[
$(function(){
	$("#myTextarea").limitWords({leftSelector: '#myTextarea_left', limit: 100, underColor: 'blue'});
});
//]]>
</script>

About

jQuery plugin that limits the number of words in a form element.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published