Bootstrap   发布时间:2022-04-18  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了twitter-bootstrap – 使用Bootstrap在表单中标记错误大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经开始使用Bootstrap为了实现一个漂亮的页面设计,而不诉诸GWT(后端是用java做的)

对于我的登录屏幕,我复制了这个example.现在我想标记一个错误,例如,用户名为空。所以我想知道什么是在Bootstrap框架中的过程为此。或者也许如果有例子显示错误的形式。

我不知道这个想法是用红色显示输入元素内部的错误消息,还是显示在输入元素下面,或者可能是弹出窗口?

解决方法

这里你去 http://jsfiddle.net/jonschlinkert/pngWh/12/

查看.error,.success,.warning和.info类如何附加到.control-group?这是标准的Bootstrap标记和样式。只要跟着,你的身体状况良好。当然你可以超越你自己的样式,添加一个弹出窗口或“内联闪存”,如果你喜欢,但如果你遵循Bootstrap约定并挂起这些验证类在.control组,它将保持一致和易于管理(在至少因为你将继续有Bootstrap文档和示例的好处)

<form class="form-horizontal">
    <div class="control-group warning">
      <label class="control-label" for="inputWarning">Input with warning</label>
      <div class="controls">
        <input type="text" id="inputWarning">
        <span class="Help-inline">Something may have gone wrong</span>
      </div>
    </div>
    <div class="control-group error">
      <label class="control-label" for="inputError">Input with error</label>
      <div class="controls">
        <input type="text" id="inputError">
        <span class="Help-inline">Please correct the error</span>
      </div>
    </div>
    <div class="control-group info">
      <label class="control-label" for="inpuTinfo">Input with info</label>
      <div class="controls">
        <input type="text" id="inpuTinfo">
        <span class="Help-inline">Username is taken</span>
      </div>
    </div>
    <div class="control-group success">
      <label class="control-label" for="inputsuccess">Input with success</label>
      <div class="controls">
        <input type="text" id="inputsuccess">
        <span class="Help-inline">Woohoo!</span>
      </div>
    </div>
  </form>

这是什么样子:

大佬总结

以上是大佬教程为你收集整理的twitter-bootstrap – 使用Bootstrap在表单中标记错误全部内容,希望文章能够帮你解决twitter-bootstrap – 使用Bootstrap在表单中标记错误所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。