2

How can I, in JS, make sure a class (Vue) is instanciated only after a certain element is inserted into the DOM?

Currently, things are executed in this order:
1. Create modal
2. Append my-element to modal
3. Show modal
4. Instanciate Class (Vue)

Gives me "Vue cannot find my-element".

However, it works if I instanciate Vue in the console after modal is visible.

Comments
  • 0
    I think you are using Vue wrong.

    You are supposed to call modal and add new element or whatever from your Vue.
  • 0
    I know it's not supposed to be like this, but I have to use another library's modal.
  • 0
    @raffaels-blog can you instantiate Vue first and add your third party modal later? Then Vue will know the new element.
  • 1
    Solved it by removing Vue and using the other library's templating thingy. 😄

    Thanks for your help to all of you!
Add Comment