I have some very simple jQuery, in my Rails .erb file, and I cannot get it to work. My .erb file is:
<script type="text/javascript">
$('.check').prop('checked', true);
</script>
<%= bootstrap_form_for(@shipping_shop, layout: :inline) do |f| %>
<div class="input-lg check">
<%= f.check_box :enabled, label: "Standard shipping enabled?" %>
</div>
.... stuff removed for brevity
<%= f.submit 'Save Standard Settings', class: 'btn btn-primary btn-lg
btn-block' %>
<% end %>
My application.js file looks like this:
//= require jquery
//= require jquery_ujs
//= require bootstrap-sprockets
//= require turbolinks
//= require_tree .
I'm using the "Rails Bootstrap Forms" gem. I can check the box by passing in arguments, but I am trying to figure out why I can't get any jQuery to work.
I am doing "Setting "checked" for a checkbox with jQuery?" exactly, but don't understand what's wrong.
I tried to change the check
class directly to the element and that didn't work either:
<div class="input-lg check">
<%= f.check_box :enabled, label: "Standard shipping enabled?",
class:"check" %>
</div>