Jordan Benett
asked on
Character counter breaks after adding EmojiOne Area
I have a character counter for my textarea that was working great until I added EmojiOne Area. The emoji picker now works great, but my character counter stopped working. For some reason the keyup is no longer working off of the ID.
HTML
JavaScript
JSFiddle.
HTML
<textarea id="message" class="form-control" placeholder="Enter text here..."></textarea>
<label><span id="chars" class="lead">140</span></label> characters left
JavaScript
/*emojioneArea */
$(document).ready(function() {
$("#message").emojioneArea({
pickerPosition: "bottom",
tonesStyle: "bullet"
});
});
/*Character Counter */
function countChar(val) {
var len = val.value.length;
if (len >= 140) {
val.value = val.value.substring(0, 140);
$('#stat span').text(0);
} else {
$('#stat span').text(140 - len);
}
}
countChar($('#message').get(0));
$('#message').keyup(function() {
countChar(this);
});
JSFiddle.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot Banshi, That worked great!
ASKER