<script type="text/javascript"> function check(textarea) { var label = document.getElementById('some'); if (textarea.value.substr(-1) == ']') label.innerHTML = 'OK'; else label.innerHTML = 'НЕТ';" } </script> <textarea onblur="check(this);"></textarea> <label id="some"></label>