我在谷歌搜索但我没有找到如何更改(夸大)form_label中的'for'attribut。
{{ form_widget(form.star,{'id':'rating-input-1-5','attr':{'class':'rating-input'}}) }}
{{ form_label(form.star,null,{'label_attr':{'class':'rating-star','for':'rating-input-1-5'}}) }}
{{ form_widget(form.star,{'id':'rating-input-1-4','attr':{'class':'rating-input'}}) }}
{{ form_label(form.star,null,{'label_attr':{'class':'rating-star','for':'rating-input-1-4'}}) }}
{{ form_widget(form.star,{'id':'rating-input-1-3','attr':{'class':'rating-input'}}) }}
{{ form_label(form.star,null,{'label_attr':{'class':'rating-star','for':'rating-input-1-3'}}) }}
{{ form_widget(form.star,{'id':'rating-input-1-2','attr':{'class':'rating-input'}}) }}
{{ form_label(form.star,null,{'label_attr':{'class':'rating-star','for':'rating-input-1-2'}}) }}
{{ form_widget(form.star,{'id':'rating-input-1-1','attr':{'class':'rating-input'}}) }}
{{ form_label(form.star,null,{'label_attr':{'class':'rating-star','for':'rating-input-1-1'}}) }}
我想在form_widget的id上使用form_label点。
有可能吗?
感谢您的回答
答案 0 :(得分:1)
尝试将form_label
调用更改为
{{ form_label(form.star,null,{'id':'rating-input-1-5', 'label_attr':{'class':'rating-star'}}) }}