How to Set Maxlength for Multiline Textbox in Asp.net c#
Live Demo:
<html xmlns="http://www.w3.org/1999/xhtml"> <head><title>jQuery set maxlength for multiline textbox in asp.net</title> <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> </head> <body> <form id="form1" runat="server"> <table> <tr> <td><b>Enter Text:</b> </td> <td> <asp:textbox id="txtdesc" textmode="MultiLine" runat="server"></asp:textbox> </td> </tr> </table> </form> </body> </html> |
Live Demo:
No comments:
Post a Comment