– 从W3C –
To associate a label with another control implicitly,the control element must be within the contents of the LABEL element. In this case,the LABEL may only contain one control element. The label itself may be positioned before or after the associated control.
In this example,we implicitly associate two labels with two text input controls:
<form action="..." method="post"> <p> <label> First name <input type="text" name="firstname" /> </label> <label> <input type="text" name="lastname" /> Last name </label> </p></form>解决方法 您可以使用块将表单帮助程序嵌套在标签内。以下是使用HAML的示例,但它也适用于ERB。
= form_for your_resource do |f| = f.label :first_name do = f.text_fIEld :first_name总结
以上是内存溢出为你收集整理的html – 嵌入输入f.label(rails表单生成)全部内容,希望文章能够帮你解决html – 嵌入输入f.label(rails表单生成)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)