```
<input type='text' maxlength='32' onkeypress='previewLength(32)'>

```

I want to decrease 32 with 1 each time a key is pressed

Im using this for a length preview (max length is 32 and each time a key is pressed it gets decreased by 1 and shows the user how much he has left)

```
<script>
function previewLength (maxLength) {
maxLength = maxLength -= 1;
document.getElementById('CounterLength').innerHTML = maxLength;
}
</script>

```