0👍
You are trying to open your modal using jQuery.
$('#myModal').modal('show')
Check if jQuery library is loaded. Here are the jQuery CDNs
- [Vuejs]-Render dynamic text-box from input and drop-down list in html, js
- [Vuejs]-Destructuring nested objects in a Vue.js Pinia store
0👍
You are using bootstrap so you can use
this.$bvModal.show("modal-id");
to open your modal. (This might depend on your Bootstrap version and might be explicit for bootstrap-vue)
Another way would be
this.$refs["modal-ref"].show();
0👍
I don’t recommend to use JQuery $ sign to access the elements so,
As official document aso suggests that
Note: It is recommended to use the
this.$bvModal.show()
andthis.$bvModal.hide()
methods (mentioned in the previous section) instead of using $ref methods.
You can Use,
this.$bvModal.show()
to show and
this.$bvModal.hide()
hide the modal
Also, this method too applicable
this.$refs['my-modal'].show()
this.$refs['my-modal'].hide()
- [Vuejs]-Vue3 Dockerize – Can't open running docker vue app in my browser
- [Vuejs]-Vite build generates different css module classes
Source:stackexchange.com