Bootstrap-如何在< textarea>上使用验证状态 [英] Bootstrap - How to use validation states on a <textarea>

查看:270
本文介绍了Bootstrap-如何在< textarea>上使用验证状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Bootstrap允许使用以下命令来验证表单内部输入的验证状态 class="form-group has-error".但这对<textarea>不起作用,奇怪的是help-inline也没有帮助吗?

Bootstrap allows for validation states for input inside of forms, using class="form-group has-error". But this doesn't work with <textarea>, and oddly enough neither does the help-inline, any help?

这是完整的输入组:

<div class="form-group">
  <label for="desc" class="col-sm-2 control-label">Description:*</label>
  <div class="col-sm-10">
    <textarea autocomplete="off" class="form-control" rows="5" name="desc" id="desc"></textarea>
  </div>
</div>

推荐答案

您可以将类form-control添加到textarea元素.

You could add the class form-control to the textarea element.

> 此处的示例

<div class="form-group has-error">
    <textarea class="form-control"></textarea>
</div>

用于此的选择器是.has-error .form-control.这也是默认样式:

The selector used for this is .has-error .form-control. Here is the default styling too:

.has-error .form-control {
    border-color: #a94442;
    -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
    box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
}

这篇关于Bootstrap-如何在&lt; textarea&gt;上使用验证状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆