Код: Выделить всё
function addEmoji(elem) {
document.querySelector('textarea').value += elem.textContent;
}
$(document).ready(function() {
$('textarea').on("input", function() {
var maxLength = $(this).attr("maxLength");
var currentLength = $(this).val().length;
var color = currentLength < strcnt[0] ? '#ff0000' : '#00BB00';
$('#minChars').css({
'color': color
});
$('#Chars').text(currentLength);
if (currentLength > strcnt[1]) {
color = '#FF9900';
}
if (currentLength > strcnt[2]) {
color = '#ff0000';
}
$('#Chars').css({
'color': color
});
});
});< /code>
🤩
Подробнее здесь: https://stackoverflow.com/questions/794 ... o-textarea