INNER CODE UNIT · JavaScript
updateCharsCountLabel
smithyhq/sqladmin · sqladmin/statics/js/main.js:603
const updateCharsCountLabel = () => {
if (!$charsCountLabel.length) return;
const $currentLength = $textarea.val().length;
$charsCountLabel.text(`Number of characters: ${$currentLength}${$maxLength ? ` / ${$maxLength}` : ''}`);
$charsCountLabel.toggleClass('warning', $maxLength > 0 && $currentLength >= $maxLength);
};
$textarea.on('input propertychange', function () {
updateCharsCountLabel();
});
updateCharsCountLabel(); // Show on start
});
// Substitute %(name)s placeholders in a translated template with values, so
// scripts only inject numbers and the surrounding text keeps its language.
function formatImportTemplate(template, values) {