I was worried about how to implement what was checked by jquery, but I did not have much information and tried to implement it myself
# rails form,id is"testBool"will do
= f.input :test_bool, as: :boolean
// jquery
$('#testBool').on('click', function() {
console.log($(this)[0]['checked'])
})
->
false
true
If you go with this implementation method, you can get true and false dynamically, so control on the js side will be much easier.
None
Recommended Posts