Last active
August 29, 2015 14:01
-
-
Save solidnerd/b5f9f18bcfcbc9a0d3c5 to your computer and use it in GitHub Desktop.
Uses JQuery to count letters on a TextArea
This file contains hidden or 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
var messageCount=0; | |
$(document).ready(onReady); | |
function onReady(){ | |
$("input").powerTip({placement:'n'}); | |
$("textarea").powerTip({placement:'n'}); | |
$("textarea").keyup(function(){ | |
if(messageCount < 160){ | |
messageCount = $(this).val().length; | |
$("#textareacounter").html("Counter:"+messageCount); | |
} | |
}); | |
} | |
$("#reset").click(function(){ | |
$("#textareacounter").html("Counter:0"); | |
messageCount = 0; | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment