【问题标题】:Using two class attributes使用两个类属性
【发布时间】:2013-10-07 19:06:43
【问题描述】:

我正在使用 jQuery validationEngine.js 插件来验证输入字段。它需要我添加一个class="validate[required] text-input",以便在提交表单时进行验证。但是我有 class="form-control" ,因此,验证不起作用。如果我删除 class="form-control" 验证将起作用,但输入框将错位。有什么办法可以同时保留吗?或者这个问题的任何其他解决方案?谢谢!

<input 
  name="selectAgent" 
  type="text" 
  class="form-control" 
  id="selectAgent" 
  class="validate[required] text-input" 
>

【问题讨论】:

标签: html css twitter-bootstrap jquery-validation-engine


【解决方案1】:

一次添加所有课程。有两个类声明可能会导致错误。

使用(注意form-control 是如何用space 添加到你的类的末尾的,这样你就可以添加另一个类了)

<input 
  name="selectAgent" 
  type="text" 
  id="selectAgent" 
  class="validate[required] text-input form-control" 
>

代替

<input 
  name="selectAgent" 
  type="text" 
  class="form-control" 
  id="selectAgent" 
  class="validate[required] text-input" 
>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-09
    • 2015-03-24
    • 1970-01-01
    • 1970-01-01
    • 2018-02-04
    相关资源
    最近更新 更多