Uncaught TypeError: $(...).aaDropdownMenu is not a function

Viewed 658

I am working on a Ruby on Rails 4.2 application and using foundation 6

Sometimes as I am navigating through the app I get a turbolink error and the header breaks throwing this error which gets resolved refreshing the page, but I want to remove this bug.

enter image description here

application.js

$(function(){ 
    $(document).foundation(); 
});

$(document).on("turbolinks:load", function() { 
    $(document).foundation();
});

Note: This error happens when I click a link, but it happens sometimes, it seems to happen mostly when I haven't visited the page in a while.

0 Answers
Related