textarea maxlength
by carlosea
HTML
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css">
<form name="myForm" ng-app>
<p>Add a string with 9 charcters and a new line ie:
<br>1245
<br>7890</p>
<textarea name="text" id="ta" maxlength="10"></textarea> <span class="error" ng-show="submitted && myForm.text.$error">Too long!</span>
<div>
<button type="submit" class="btn btn-primary btn-large" ng-click="submitted=true">Submit</button>
</div>
</form>
CSS
body {
margin: 0px;
padding:20px;
font:200 14px/40px Arial;
}
textarea {
margin-top:15px;
margin-bottom:0px;
width:200px;
padding:10px;
color:#21323B;
font-size:16px;
border:solid 2px;
border-radius:4px;
resize: none;
}
button {
border:1px solid #ccc;
width:100px;
padding:3px;
margin-top:10px;
border-radius:5px;
display:block;
}
p {
margin:0px;
color:#21323B;
line-height: 0.5cm;
}
.error {
color:#FF2200;
}