Skip to content

RadioButtonTag

Antonio Pagano edited this page Mar 14, 2018 · 1 revision

Tags provides a convenient way to build an HTML element with type="radio":

<%= f.RadioButtonTag({name: "MyDrink"}) %>

That produces:

<label>
  <input class=" form-control" name="MyDrink" type="radio" checked />
</label>

You can easily change the label content with

<%= f.RadioButtonTag({name: "MyDrink", label: " Water"}) %>

That produces:

<label>
  <input class=" form-control" name="MyDrink" type="radio" checked /> Water
</label>
Clone this wiki locally