Error in console browser: Uncaught TypeError: $ (...). AaDropdownMenu is not a function
Asked Answered
F

2

1

I have a project on rails that uses Active_Admin and other plug-ins, I get this error in the browser console. How do I fix this?

Uncaught TypeError: $(...).aaDropdownMenu is not a function
    at HTMLDocument.onDOMReady (dropdown-menu.self-5794b6ca26364ce522cb47a8ef050870fda0b886cfeef69ec27ef116900f1984.js?body=1:121)
    at HTMLDocument.dispatch (jquery3.self-5af507e253c37e9c9dcf65064fc3f93795e6e28012780579975a4d709f4074ad.js?body=1:5184)
    at HTMLDocument.elemData.handle (jquery3.self-5af507e253c37e9c9dcf65064fc3f93795e6e28012780579975a4d709f4074ad.js?body=1:4992)
    at Object.e.dispatch (turbolinks.self-569ee74eaa15c1e2019317ff770b8769b1ec033a0f572a485f64c82ddc8f989e.js?body=1:6)
    at r.notifyApplicationAfterPageLoad (turbolinks.self-569ee74eaa15c1e2019317ff770b8769b1ec033a0f572a485f64c82ddc8f989e.js?body=1:7)
    at r.pageLoaded (turbolinks.self-569ee74eaa15c1e2019317ff770b8769b1ec033a0f572a485f64c82ddc8f989e.js?body=1:7)
    at turbolinks.self-569ee74eaa15c1e2019317ff770b8769b1ec033a0f572a485f64c82ddc8f989e.js?body=1:6

application.js

//= require rails-ujs
//= require activestorage
//= require jquery
//= require turbolinks
//= require popper
//= require jquery.slick
//= require_tree .

activ_admin.js.coffe

#= require active_admin/base

and console

$.widget.bridge('aaDropdownMenu', ActiveAdmin.DropdownMenu);

onDOMReady = function() {
  return $('.dropdown_menu').aaDropdownMenu();     // Uncaught TypeError: $(...).aaDropdownMenu is not a function
};
Foetid answered 18/9, 2018 at 15:4 Comment(0)
L
0

I have exactly the same error. You should change the order in application.js jquery should be in the first place (it's a very important library). I also changed the version of the jquery library.

//= require jquery3
//= require rails-ujs
//= require activestorage
//= require turbolinks 
//= require popper
//= require jquery.slick
//= require_tree .
Lester answered 9/10, 2018 at 8:26 Comment(0)
S
0

I found this article helped: https://github.com/activeadmin/activeadmin/issues/3351#issuecomment-249524207

Remove require_tree .

Supply answered 27/8, 2024 at 4:11 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.