user7055375
user7055375

Reputation:

How do I create a checkbox that's disbaled by default in Rails?

I'm using Rails 5. How do I create a checkbox that is disabled (not clickable) by default? I tried

<%= f.check_box :mybox, :tabIndex => '1', :enabled => false %>

but the resulting checkbox is still rendered as enabled.

Upvotes: 0

Views: 837

Answers (1)

Shannon
Shannon

Reputation: 3018

You can use the disabled attribute:

<%= f.check_box :mybox, tabIndex: '1', disabled: true %>

Upvotes: 3

Related Questions