Hi Team,
How to show Number of Characters Remaining in Textbox or Textarea inside updatepanel with common js function
With reference to the below link.
Can we make a general function for Characters left count in textbox/textarea.
Which accepts parameter like :
1. Character length.2 ControlID(textbox) 3.LabelId
so i acn use this function anywhere in my page multiple controls.
Please help.
<script type="text/javascript">
$(function () {
LimtCharacters(500);
});
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm != null) {
prm.add_endRequest(function (sender, e) {
if (sender._postBackSettings.panelsToUpdate != null) {
LimtCharacters(500);
}
});
};
function LimtCharacters(CharLength) {
var txtMsg = document.getElementById('<%=txtIdeaDesc.ClientID%>');
chars = txtMsg.value.length;
document.getElementById('lblcount').innerHTML = CharLength - chars;
if (chars > CharLength) {
txtMsg.value = txtMsg.value.substring(0, CharLength);
}
}
</script>