[Pas2js] bootstrap 5 modal: JQuery(...).modal is not a function
Michael Van Canneyt
michael at freepascal.org
Fri Aug 11 13:01:46 CEST 2023
On Fri, 11 Aug 2023, Luca Olivetti via Pas2js wrote:
> El 11/8/23 a les 11:53, Michael Van Canneyt via Pas2js ha escrit:
>> On Fri, 11 Aug 2023, Luca Olivetti via Pas2js wrote:
>>> since I need to show/hide a bootstrap 5 modal, I thought I could use the
>>> TBootstrapModal defined in bootstrapwidgets, however it gives the
>>> exception in the subject: "JQuery(...).modal is not a function.
>>> This comes from ApplyWidgetSettings:
>>> since TBootstrap is defined as a class helper for TJQuery.
>>> I'm not an expert in web technologies, but I guess this is due to the fact
>>> that libbootstrap is for bootstrap 4 and I'm using bootstrap 5.
>> It also works with bootstrap 5, but you must simply include jquery
> Do you mean I have to include some other unit (which?) or import jquery with
> a <script> tag (which I did)?
The latter: Import jquery with a tag, make sure it is before the bootstrap js.
(bootstrap 5 tries to detect the presence of jquery, so jquery must be first)
I use bootstrap 5 with the libbootstrap in several commercial projects,
so I am quite sure it works :-)
More information about the Pas2js