@nedash,
Try following...
<script type="text/javascript">
function CountChar(txtmsg) {
var count = document.getElementById(txtmsg).value.length;
if (count > 1 && count <= 160) {
document.getElementById('charstatus').innerHTML = 160 - document.getElementById(txtmsg).value.length;
}
if (document.getElementById(txtmsg).value.length > 160 - 1) {
document.getElementById('charstatus').innerHTML = "Maximum characters reached!";
}
}
</script>
<div class="col-md-6">
<div class="form-group">
<label>Enter the message you want to set</label>
<textarea id="txtmsg" runat="server" class="form-control" maxlength="160" rows="3"
placeholder="Message content should not exceed 160 characters."
onkeyup="CountChar(this.id);"></textarea>
<asp:CheckBox ID="chkdefault" CausesValidation="true" AutoPostBack="true" ToolTip="Set this message as default for the selected area." runat="server" Text="Set this message as default" />
<div class="pull-right">
<p>Characters remaining: <button class="btn btn-default disabled" id="charstatus"></button></p>
</div>
</div>
</div>