<textarea id="test1">1 2</textarea> <script type="text/javascript"> alert(document.getElementById("test1").value.length); </script>