Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function () {
- var text = $('#textarea');
- text.on('input', function (event) {
- if (text.val().length <= 100) {
- $('p').text(text.val().length);
- if(text.val().length > 0 && text.val().length < 34){
- $('p').css('color', 'green');
- } else if (text.val().length > 33 && text.val().length < 67){
- $('p').css('color', 'orange');
- }else if (text.val().length > 66 && text.val().length < 101){
- $('p').css('color', 'red');
- }
- } else {
- text.on('keypress', function(event){
- event.preventDefault();
- });
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement