There is another question on this site that is the similar to this one, but unfortunately after trying all of the suggestions following that question, I still haven't found a solution.
My Navbar is looking very basic at this point:
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand"<%= link_to 'GoChat', root_path %></a>
</div>
<ul class="nav navbar-nav">
<li class="nav-item">
<%= link_to 'New Comment', new_comment_path %></li>
<li class="nav-item active">
<%= link_to 'View Comments', comments_path %></li>
<li class="nav item">
<%= link_to 'Profile', user_path(current_user) %></li>
</ul>
</div>
</nav>
Following the advice given on the question Bootstrap navbar Active State not working, I tried adding the following code to my application js file, but this didn't work. I also tried using html links instead of the embedded Ruby links I'm currently using.
$(".nav-item").on("click", function(){
$(".nav").find(".active").removeClass("active");
$(this).parent().addClass("active");
});
I also tried using the "nav a" tag in the jquery code, and even the "li" tag too but this didn't work.
I'm not using the Bootstrap CDN - I downloaded the compressed and minified files to my app. I tried with the CDN also but to no effect. Other than that, I think the only thing to mention is that the following code is used in my application js:
//= require rails-ujs
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require bootstrap-sprockets
//= require_tree .
and in application css:
*= require_tree .
*= require_self
*= require rails_bootstrap_forms
I don't have any idea of what to try next so I would really appreciate some help on this one, thanks :-)