Created
July 29, 2016 16:27
-
-
Save ScottDeLuzio/1c6999934a82508d653973e432590a5d to your computer and use it in GitHub Desktop.
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(document).ready(function() | |
{ | |
jQuery("#order_comments").attr('maxlength','140'); // make sure to change the 140 number here to match the number after remaining below | |
countdownCharacters(); | |
jQuery('#order_comments').change(updateCountdown); | |
jQuery('#order_comments').keyup(updateCountdown); | |
}); | |
function countdownCharacters() { | |
// 140 is the max message length | |
var remaining = 140 - jQuery('#order_comments').val().length; | |
jQuery('.order_countdown').html('<label for="order_comments">Order Notes</label>' + remaining + ' characters remaining.'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment