Get a warning when the maximum char limit has been exceeded with a simple jQuery plugin
- Only 1 js file
- < 1Kb minified (495 bytes)
- Easy to implement
- Works with inputs, textareas.
Using bower
bower install max-char-limit-warning --save-dev
Using npm
npm install max-char-limit-warning --save-dev
or download the plugin from GitHub
Load them in the html
<!-- jQuery library (served from Google) -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<!-- jcSlider Javascript file -->
<script src="jquery.maxcharwarning.min.js"></script>
or use Browserify
require('maxCharWarning');
<input
class ="js-max-char-warning"
placeholder="Your name"
type="text"
data-max-length-warning="limit exceeded"
data-max-length="10"
data-max-length-warning-container="name"
/>
<span class="name"></span><!-- Display warning message here -->
Default initialization
<script type="text/javascript">
$(document).ready(function(){
$('.js-max-char-warning').maxCharWarning();
});
</script>
★ Star and watch this repo in order to stay updated with news about this plugin
- jcSlider: A responsive slider jQuery plugin with CSS animations
- html5 canvas animation: 3D lines animation with three.js
- slide and swipe menu: A sliding swipe menu that works with touchSwipe library.
- jquery dynamic max height : Dynamic max height plugin for jQuery with CSS animation
The MIT License (MIT)
Copyright (c) 2015 Joan Claret
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.