Created
June 28, 2016 09:48
-
-
Save solid-pixel/02018353d5773c3ae8851d693c9b6059 to your computer and use it in GitHub Desktop.
Reduce input text size based on number of characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery('#target').keypress(function() { | |
var textLength = jQuery(this).val().length; | |
if(textLength < 10) { | |
// Do noting | |
} else if (textLength < 13) { | |
jQuery(this).css('font-size', '85%'); | |
} else if (textLength > 16) { | |
jQuery(this).css('font-size', '70%'); | |
} | |
//console.log(textLength); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment