We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

How to bind Events on Ajax loaded Content in the puzzle?

Home Forums Puzzles How to bind Events on Ajax loaded Content in the puzzle?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #51206
    scatman2513
    Participant

    I have an user-interface around my Verge-3D-Application with many different on/off buttons that will be loaded with JQuery’s load() depending on different situations.

    Now I’ve seen that my click listeners in the puzzle wont work on new generated buttons that I’ve loaded with Ajax/JQuery.

    I know this issue from vanilla JS/Jquery where you can use an event delegation for dynamically created elements (See here).

    How do I create these listeners in the puzzle? Because the “on event of change for element abc (in parent docs)” wont work.

    #51293

    hi,

    a possible workaround is to use the “on event” puzzle after the content is loaded. You can trigger puzzles at proper moment via JavaScript

    To execute Puzzles procedures from the external JavaScript code, use the v3d.puzzles.procedures namespace:
    v3d.puzzles.procedures['myProcedure']();

    https://www.soft8soft.com/docs/manual/en/puzzles/Procedures.html

    Chief 3D Verger | LinkedIn | Twitter

    #51355
    scatman2513
    Participant

    Hi Yuri, thanks for your fast reply.

    You’re right, with the procedures I can then add & bind the event-listeners once I’ve reloaded the content with Ajax. Now its working.

    Thanks a lot!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.