Thursday, 20 February 2014

jQuery set maxlength for multiline textbox in ASP.NET

Here I will explain how to set maxlength for multiline textbox in asp.net using jQuery or set of maxlength for asp.net multiline textbox in jQuery.

<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js">
</script>
<script type="text/javascript">
$(function() {
$('#txtdesc').keypress(function(e) {
var txt = $(this).val();
if (txt.length > 50) {
e.preventDefault();
}
});
});
</script>

No comments:

Post a Comment