Skip to content

Instantly share code, notes, and snippets.

@ScottDeLuzio
Created July 29, 2016 16:27
Show Gist options
  • Save ScottDeLuzio/1c6999934a82508d653973e432590a5d to your computer and use it in GitHub Desktop.
Save ScottDeLuzio/1c6999934a82508d653973e432590a5d to your computer and use it in GitHub Desktop.
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