How can I break the line after typing for certain length in javascript. In my application, the line must break after it reaches the length 10. I have the following code:

```
<script>
function breakLine()
{
    var l = document.getElementById("textarea1").value;
    if(l.length > 10)
    {
        l = l + "<br />";
    }
}
</script>
</head>
<body>
<textarea id="textarea1" onKeyUp="breakLine()" rows="5" cols="100"></textarea>
</body>

```