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.

Button created in puzzles does not work

Home Forums Puzzles Button created in puzzles does not work

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #56330
    felix
    Customer

    Hello. I created this test.
    1. I want the button with mouseover to turn red, with mouseout to turn gray.
    2. Then with the click it remains solid red, mouseover is deactivated and a modal opens.
    3. Then I want that clicking either on the modal or the same button closes the modal and the button turns gray again and mouseover activates again.
    But part 3 doesn’t work. Where am I wrong?

    https://v3d.net/be2

    Attachments:
    You must be logged in to view attached files.
    #56334
    kdv
    Participant

    On the app loading you create event listeners ‘click’ for non-existing elements button_2 and modal_1 (they will be created only when you click button_1). Put the 5th puzzle inside the 4th puzzle (at the end) and the last puzzle place inside the 3rd puzzle.

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #56336
    felix
    Customer

    Supper! But it works only once.
    How can I reactivate button_1? It must have the same options as before again. Now it doesn’t work anymore.
    Thank you.

    #56337
    kdv
    Participant

    That’s because you’ve removed the first button_1 with all its event listeners. The second button_1, created later, is not the same. The 2nd, 3rd and 4th puzzles don’t work any more. You need to re-register event listeners for the newly created button_1.

    P.S. Do not remove it. Just hide/show it.

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #56339
    felix
    Customer

    Thanl you for your patience :good:
    solved this way and it works :yahoo:

    Attachments:
    You must be logged in to view attached files.
    #57354
    visualizer
    Customer

    Hi
    Felix

    I was checking your link of button but the third point is not working.
    you have the final worked link?

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