How to Set Maximum Length to Textarea or jQuery Check Textarea Maxlength Using JQuery
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>jQuery Check count of textarea</title> <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"> </script> <script type="text/javascript"> $(function () { $('#btnCheck').click(function () { var txt = $('#txtdesc').val(); if (txt.length > 50) { alert('Please enter less than 50 characters') } }); }) </script> </head> <body> <div> <table> <tr> <td> <b>Enter Text:</b> </td> <td> <textarea cols="20" id="txtdesc" rows="2"> </textarea> </td> </tr> <tr> <td></td> <td> <input type="button" id="btnCheck" value="Check Length" /> </td> </tr> </table> </div> </body> </html> |
|
No comments:
Post a Comment