I'm confused. Some of the basic jQuery method just doesn't work. When the other do.
It's my application.js file
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require bootstrap-toggle-buttons
//= require turbolinks
//= require_tree .
I have a modal, where I want to make some changes (add tick), when div is clicked.
This code works.
$(document).ready(function(){
   $( ".product-to-choose" ).click(function() {
       var icon = jQuery(this).find("i");
       icon.css("display","inline");
   });
 });
But when I want to add option to unchecked:
$(document).ready(function(){
   $( ".product-to-choose" ).click(function() {
       var icon = jQuery(this).find("i");
       icon.toggleClass('visible');
   });
 });
It doesn't work...
So I try do it another way:
$(document).ready(function(){
   $( ".product-to-choose" ).click(function() {
       var icon = jQuery(this).find("i");
       if(icon.hasClass('visible')){
           icon.removeClass('visible');
       }
       else{
           icon.addClass('visible');
       }
   });
});
Then it first added class, but when I clicked once again, nothing is gone. I have no idea what's going on. Is it any incompatibility between jQuery and Rails?
 
    