f.input :rol, as: :radio, :label => "Rol", :collection => [ 'leerling', 'leraar' ]
那么我怎么知道何时选择了一个单选按钮,因为当选择'leerling'时它需要显示表单的特定部分
jQuery >= 1.6
$("#rol").prop('checked', true);
jQuery < 1.6
$("#rol").attr('checked', true);
use distinct id
or class
to check this property
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.