Git Product home page Git Product logo

Comments (7)

daidensacha avatar daidensacha commented on May 24, 2024

from bootstrap-colorpicker.

cjbarth avatar cjbarth commented on May 24, 2024

I experience an issue with Bootstrap 5 and this control as well. I get an error saying that this.popoverTarget.popover is not a function. When I move back to 4.x, things work fine. Given how different popovers work between Bootstrap 4 and 5, I'm not surprised this is an issue.

from bootstrap-colorpicker.

itsjavi avatar itsjavi commented on May 24, 2024

Have you tried loading the popover package separately?

In the "with bootstrap" example, it includes the popover package because it's loading the bootstrap bundle: /unpkg.com/[email protected]/dist/js/bootstrap.bundle.min.js

Edit: Ok I see that in BS5 they still have his bundle. As Chris suggested, the popover API might have changed and it's not compatible anymore :(

from bootstrap-colorpicker.

hkvstore avatar hkvstore commented on May 24, 2024

For Bootstrap 5, change this line:

this.popoverTip = $(this.popoverTarget.popover('getTipElement').data('bs.popover').tip);
to

if (bootstrap) // Bootstrap 5  
	this.popoverTip = $(bootstrap.Popover.getInstance(this.popoverTarget[0]).getTipElement());
else // Boostrap 4
	this.popoverTip = $(this.popoverTarget.popover('getTipElement').data('bs.popover').tip);

from bootstrap-colorpicker.

fritzfr avatar fritzfr commented on May 24, 2024

Above solution is not complete. For me, the error is above the mentioned line:

this.popoverTarget.popover is not a function
    at PopupHandler.createPopover (bootstrap-colorpicker.js:4188)

from bootstrap-colorpicker.

hkvstore avatar hkvstore commented on May 24, 2024

You need to include either bootstrap 4 or 5 .js first.

from bootstrap-colorpicker.

OlivierGrimard avatar OlivierGrimard commented on May 24, 2024

For Bootstrap 5.1.3, I was getting the error "Cannot read properties of null (reading 'getTipElement')" so I changed the method getInstance to use getOrCreateInstance.

this.popoverTip = $(bootstrap.Popover.getOrCreateInstance(this.popoverTarget[0]).getTipElement());

this.popoverTip = useGetInstance ? (0, _jquery2.default)(bootstrap.Popover.getInstance(this.popoverTarget[0]).getTipElement()) : (0, _jquery2.default)(this.popoverTarget.popover('getTipElement').data('bs.popover').tip);
To
this.popoverTip = useGetInstance ? (0, _jquery2.default)(bootstrap.Popover.getOrCreateInstance(this.popoverTarget[0]).getTipElement()) : (0, _jquery2.default)(this.popoverTarget.popover('getTipElement').data('bs.popover').tip);

I hope it can help someone.

from bootstrap-colorpicker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.