Topic: Toast - Update Position is throwing "Cannot read properties of null (reading 'update')"
DiStefano premium asked 1 year ago
Hello all,
In my application I am trying to do a simple:
instance.update({ position: 'top-right', });
Using from the example in the DOCs:
const instance = mdb.Toast.getInstance(document.getElementById('position-example-toast'));
instance.update({ position: 'bottom-right', });
But in the console in Edge, it's throwing and not doing bottom-right:
Uncaught TypeError: Cannot read properties of null (reading 'update')
I'm using "mdb.min.js" from version 6.4 Pro but it constantly laughs at me, I don't think it's the order I'm pulling in the JS
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/mdb/js/mdb.min.js"></script>
Thanks
Kamila Pieńkowska staff answered 1 year ago
Here is a snippet showing how to update the toast position: https://mdbootstrap.com/snippets/standard/kpienkowska/5553888
DiStefano premium commented 1 year ago
Thank you, but the reason that I'm inquiring about using the "instance.update" is because I want to give the users an option on where they want to position the notifications and I just don't understand why I am getting the "Cannot read properties of null (reading 'update')". Thanks
DiStefano premium commented 1 year ago
kpienkowska, disregard my above comment, I'm a knucklehead. For some reason, your snippet that you provided above, works in my app without giving me an issue with the 'update' in my JS. Thanks again, much appreciated.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- ForumUser: Premium
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 6.4.0
- Device: Desktop
- Browser: Edge
- OS: Windows 11
- Provided sample code: Yes
- Provided link: No