在Rails表单帮助器中包含bootstrap角色属性 [英] include bootstrap role attribute in rails form helper

查看:136
本文介绍了在Rails表单帮助器中包含bootstrap角色属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Twitter引导程序具有以下角色属性,用于表单:

Twitter Bootstrap has this role attribute for forms:

<form role="form">

如何在Rails表单帮助器中包含role属性?我试过了,但是没用:

How can I include the role attribute in Rails form helpers? I tried this, but it doesn't work:

<%= form_for @user, class: "form-horizontal", role: "form" do |f| %>

推荐答案

您需要将其指定为html选项:

You need to specify it as an html option:

<%= form_for @user, html: {class: "form-horizontal", role: "form"} do |f| %>

这篇关于在Rails表单帮助器中包含bootstrap角色属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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