【发布时间】:2017-03-09 09:08:47
【问题描述】:
我希望对表单的输入框设置字符限制。理想情况下,我想要 140 个字符,但不知道该怎么做。
我在前端使用 Angular。
我的输入部分代码我需要 new.html 的文本限制
<div class="form-group">
<label>Description 140 characters</label>
<input type="text" ng-model="postsNew.post.description" class="form-control" </textarea>
我尝试使用另一种 textarea 方式,但它删除了我的一半表单。
这是我本节的完整代码
<section class="container">
<h1>What happened?</h1>
<form ng-submit="postsNew.submit()">
<div class="form-group">
<label>Tube Line</label>
<select ng-model="postsNew.post.line" class="form-control">
<option ng-repeat="line in postsNew.linesList" value="{{line}}">
{{line}}
</option>
</select>
</div>
**
<div class="form-group">
<label>Description 140 characters</label>
<input type="text" ng-model="postsNew.post.description"
class="form-control" </textarea>
</div>
**
<div class="form-group">
<label>Date</label><br>
<input id="enddatefield" type="date" ng-model="postsNew.post.date"
class="form-control">
</div>
<div class="form-group">
<label>Time</label><br>
<input type="time" name="name" ng-model="postsNew.post.time"
class="form-control">
</div>
<input type="submit" value="Fingers crossed..." class="btn btn-primary
pull-right">
</form>
</section>
【问题讨论】:
标签: javascript jquery html angularjs