Question: > 
> i have a textbox and i want dynamic character count of how many char
>  are left out of total max limit=500.
> 
> 
> 

```
<asp:TextBox ID="TextBox2" runat="server" TextMode="MultiLine" Width="300" Height="100">asp:TextBox>

```

Answer: 
You can use `val.value.length` to get a number of characters in the textbox/textarea.

```js
function countChar(val) {
  var len = val.value.length;
  if (len >= 500) {
    val.value = val.value.substring(0, 500);
  } else {
    $('.numbersofChart').text(500 - len);
  }
};
```

```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<textarea id="TextBox2" onkeyup="countChar(this)"></textarea>
<div class="numbersofChart"></div>
```
**solved your issue please test this code may help you better**

```
<h5 >Characters Left <span id="remaining">500</span></h5>

<input type="text" id="question_comment_body" name="question_comment_body" placeholder="Your Comment Here...">

<script type="text/javascript">
    function charCount() {
        var textEntered = document.getElementById('question_comment_body').value;
        var msg = document.getElementById('remaining');
        var counter = (500-(textEntered.length));
        msg.textContent = counter;
    }
    var el = document.getElementById('question_comment_body');
    el.addEventListener('keyup',charCount,false);
</script>

```