|
@ -1,3 +1,4 @@ |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
* charcount.js |
|
|
* charcount.js |
|
|
* |
|
|
* |
|
@ -16,14 +17,17 @@ $(document).ready(function(){ |
|
|
var $coundownField = $('#countchar'); |
|
|
var $coundownField = $('#countchar'); |
|
|
var $maxChars = 6001; |
|
|
var $maxChars = 6001; |
|
|
|
|
|
|
|
|
|
|
|
if ($inputArea.length == 0) |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
// Preset countdown field to max initial content length
|
|
|
// Preset countdown field to max initial content length
|
|
|
$coundownField.text($maxChars - $inputArea.length); |
|
|
$('.countdown').text($maxChars - $inputArea.val().length); |
|
|
|
|
|
|
|
|
// input :: for all modern browsers [1]
|
|
|
// input :: for all modern browsers [1]
|
|
|
// selectionchange :: for IE9 [2]
|
|
|
// selectionchange :: for IE9 [2]
|
|
|
// propertychange :: for <IE9 [3]
|
|
|
// propertychange :: for <IE9 [3]
|
|
|
$inputArea.on('input selectionchange propertychange', function() { |
|
|
$inputArea.on('input selectionchange propertychange', function() { |
|
|
$charCount = $maxChars - $inputArea.val().length; |
|
|
$charCount = $maxChars - $inputArea.val().length; |
|
|
$coundownField.text($charCount); |
|
|
$('.countdown').text($charCount); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |