Hello i want to ask why my code doesn't work. I use ruby on rails with bootsrap and haml.
Here is my javascript code:
:javascript
$(".nav navbar-nav li a").click(function() {
$(this).parent().addClass('active').siblings().removeClass('active');
});
And here is my navigation bar's code:
%nav.navbar.navbar-inverse
.container-fluid
.navbar-header
%img.image{:alt => "Ruby Logo", :src => "http://www.rossconf.io/images/projects/ruby-2779abad.png"}
= link_to "Users", users_path, class: 'navbar-brand'
#bs-example-navbar-collapse-1.collapse.navbar-collapse
%ul.nav.navbar-nav
%li
%a{:href => addresses_path}
Addresses
%span.sr-only (current)
%li
%a{:href => imports_path}
Import addresses
%span.sr-only (current)
- if current_user
%li
%a{:href => logout_path}
Logout
%span.sr-only (current)
- else
%li
%a{:href => login_path}
Login
%span.sr-only (current)
Any idea why it runs without errors but nothing happens? Active class is not added to li element.