Skip to content

Instantly share code, notes, and snippets.

Martin Malek martinmalek

  • Malmö
Block or report user

Report or block martinmalek

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
martinmalek / gist:7615039
Created Nov 23, 2013
How can I set active tab by mixing in jQuery.localStorage variable in a rails erb condition?
View gist:7615039
<ul class="nav nav-tabs">
<% @booking.booked_rooms.each_with_index do |booked_room, index| %>
<li class=""><a href="#room-<%= index %>" data-toggle="tab"><%= booked_room.door.title %></a> </li>
<% end %>
<script type="text/javascript" >
$(".nav-tabs").on('click', function(e) {
localStorage.setItem( 'booking-tab',$('.nav-tabs .active').find("a").attr("href") );
You can’t perform that action at this time.