Skip to Content
Menu
This question has been flagged
2 Replies
1240 Views

I am trying to show my Bootstrap dropdown menu on t-on-keyup. 

When i try to call new bootstrap.Dropdown(element) is says that it's undefined.

If I'm correct, bootstrap is already inside the odoo system. So I don't have any imports for bootstrap in my application.

This is the function I am trying to call:

showDropdown = (dropdownElement) => {
    if (dropdownElement) {
​const dropdown = new bootstrap.Dropdown(dropdownElement);
​dropdown.show();
    }
}

Do I still need to import bootstrap individually? Or am I doing something else wrong?

Avatar
Discard
Best Answer

For anyone else wondering, I think it depends on the bootstrap version being used. 

For me it worked with:

$("#element_id").modal("show") # or .modal("hide")

More here: getbootstrap.com/docs/4.0/components/modal/

Avatar
Discard
Author Best Answer

I found out that you can access DOM elements via jQuery like this "$(element)".

So I made it work with $('#dropdownElement').show()

Avatar
Discard
Related Posts Replies Views Activity
5
Mar 25
2814
1
Feb 25
1344
0
Nov 24
930
2
Oct 24
1562
1
Oct 24
11728