bigskysoftware / htmx

</> htmx - high power tools for HTML
https://htmx.org
Other
38.61k stars 1.31k forks source link

Custom modal in examples not working #2999

Closed cmnstmntmn closed 2 weeks ago

cmnstmntmn commented 2 weeks ago

Hi, hmx is a briliant project! Congrats to you all.

I'm trying to implement a custom modal, however the custom modal in the examples is not working.

<div id="modal" _="on closeModal add .closing then wait for animationend then remove me">
    <div class="modal-underlay" _="on click trigger closeModal"></div>
    <div class="modal-content">
        <h1>Modal Dialog</h1>
        This is the modal content.
        You can put anything here, like text, or a form, or an image.
        <br>
        <br>
        <button class="btn danger" _="on click trigger closeModal">Close</button>
    </div>
</div>

what puzzles me is the _="..." attribute that is not doing anything .. replaced it with hx-trigger still is not triggering anything.

am i missing something? thank you

youssame commented 2 weeks ago

I think you need to add the CSS as well.

cmnstmntmn commented 2 weeks ago

nah, is not that

MichaelWest22 commented 2 weeks ago

This example needs some client side library to do client scripting and in this case uses hyperscript which uses _="" tags to define human readable scripts. Without including a script link to hyperscript in your page header this part of the example will not work.

cmnstmntmn commented 2 weeks ago

thanks @MichaelWest22 , what was it.