Код: Выделить всё
function showEmoji(elem) {[b] 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 < 20 ? '#ff0000' : '#00BB00';
$('#minChars').css({
'color': color
});
$('#Chars').text(currentLength);
if (currentLength > 480) {
color = '#FF9900';
}
if (currentLength > 500) {
color = '#ff0000';
}
$('#Chars').css({
'color': color
});
});
});< /code>
🤩
0[/b] from min. [b]20[/b] and max. [b]500[/b] Characters used.
Подробнее здесь: https://stackoverflow.com/questions/794 ... o-textarea