https://htmx.org logo
Join Discord
Powered by
# htmx-general
  • g

    gorgeous-airport-54386

    04/27/2023, 7:32 PM
    [www.google.com](https://denizaksimsek.com)
  • g

    gorgeous-airport-54386

    04/27/2023, 7:33 PM
    # asd ## asd ### asd #### asd ##### asd ###### asd
  • s

    shy-knife-59740

    04/27/2023, 7:33 PM
    lmao the ammount of rickrolls that will be done in the following days.
  • s

    shy-knife-59740

    04/27/2023, 7:33 PM
    with custom links
  • s

    shy-knife-59740

    04/27/2023, 7:34 PM
    imagine a guy comes here, clicks a wiki link just to get rickrolled
  • g

    gorgeous-airport-54386

    04/27/2023, 7:35 PM
    no fun allowed!

    https://cdn.discordapp.com/attachments/725789747212976259/1101230040898879569/image.png▾

  • s

    shy-knife-59740

    04/27/2023, 7:58 PM
    # ||get jumpscared||
  • w

    white-motorcycle-95262

    04/27/2023, 8:08 PM
    How do I disable scrolling when new content is appended to page via HTMX? I just have
    hx-swap="outerHTML"
  • s

    shy-knife-59740

    04/27/2023, 9:51 PM
    is it worth to get htmx and hyperscript as npm packages, webpack them into a bundle and ship it with the bundle?
  • s

    shy-knife-59740

    04/27/2023, 9:52 PM
    cuz htmx + hyperscript is 150kb, wonder if it would be possible to strip those packages to only the modules/functions that are used in the code
  • w

    white-motorcycle-95262

    04/27/2023, 10:19 PM
    I was looking over that earlier, problem is I don't want it to scroll, but it seems like it's doing that even though I'm not asking it to. There's no parent elements with scrolling enabled (the navbar has it, but that's not a direct parent), so I'm not sure
  • b

    bitter-machine-55943

    04/27/2023, 11:32 PM
    Isn’t the V-for-vendetta character causing chaos by fighting the establishment?
  • b

    bitter-machine-55943

    04/28/2023, 3:55 AM
    How about Wreck It Ralph?
  • l

    little-electrician-91324

    04/28/2023, 9:26 AM
    I'm returning an HTML fragment (loaded by HTMX) from the server that looks like this:
    Copy code
    <h1 hx-on="htmx:afterSettle: alert('hello1');
               click: alert('hello2');">Hello</h1>
    I'd like an alert to be shown as soon as the HTML returned in the fragment is loaded. But nothing happens. Clicking on the header will show an alert with "hello2". I've also tried changing the event to
    htmx:afterSwap
    to no avail. How can I make this work?
  • r

    ripe-action-67367

    04/28/2023, 9:42 AM
    use
    htmx:load
    event
  • l

    little-electrician-91324

    04/28/2023, 12:16 PM
    Thank you, that works!
  • l

    little-electrician-91324

    04/28/2023, 12:32 PM
    I have this piece of html:
    Copy code
    <div id="showIt"><!-- --></div>
    
    <sl-button
            id="someId"
            variant="primary"
            style="margin-bottom: 1rem;"
            hx-get="/my-app/stuff"
            hx-target="#showIt">
        Show it
    </sl-button>
    /my-app/stuff
    returns this HTML:
    Copy code
    <button hx-on="click: alert('ikk')">Close</button>
    This works exactly like I want the first time I click on the (sl-)button with id
    someId
    . But the second time, I essentially just want the second button to be re-rendered again. But instead, I see two buttons next to each other with the text "Close" and I get an with HTMX:
    Copy code
    mx.min.js:1 htmx:swapError
    `
    and
    Copy code
    TypeError: t.onHandlers is not iterable
    I don't understand why, and using
    htmx.logAll()
    doesn't make me any wiser.

    https://cdn.discordapp.com/attachments/725789747212976259/1101486201665486891/image.png▾

    https://cdn.discordapp.com/attachments/725789747212976259/1101486202089132134/image.png▾

  • r

    ripe-action-67367

    04/28/2023, 12:39 PM
    can reproduce, looks like a bug in hx-on implementation
  • l

    little-electrician-91324

    04/28/2023, 12:41 PM
    Thank you, should I report it on github?
  • r

    ripe-action-67367

    04/28/2023, 12:41 PM
    yep
  • r

    ripe-action-67367

    04/28/2023, 12:49 PM
    I think there it should've been
    for ... in
    , not
    for ... of
    , -> https://github.com/bigskysoftware/htmx/blob/master/src/htmx.js#L924
  • m

    mysterious-toddler-20573

    04/28/2023, 1:18 PM
    oof
  • m

    mysterious-toddler-20573

    04/28/2023, 1:18 PM
    my bad
  • b

    blue-gold-89534

    04/28/2023, 1:35 PM
    If I have a page with many HTMX loaded elements, some of them have actions like:
    hx-trigger="load, every 30s"
    I can make everything inside a tag "stay" with using
    hx-preserve="true"
    on parent elements. I now want to start a js library (a chart that is being drawn) when htmx swapped in the
    <div>
    to hold the chart. I tried:
    Copy code
    htmx.onLoad(function(elt) {
      chart();
    }
    but this initializes
    chart()
    everytime another
    load, every Ns
    triggers a reload. is there a way to identify a specific element for
    onLoad
    ?
  • r

    ripe-action-67367

    04/28/2023, 1:55 PM
    check the value of elt argument, it should contain the loaded element, so you can only initialize what is needed
  • b

    broad-greece-52242

    04/28/2023, 3:09 PM
    Hi everyone, I am trying to use htmx to load some elements after a vanilla (no htmx) POST form submission. My htmx elements are using the
    hx-trigger="load delay:1s"
    pattern and work fine before the form submission, but stop after the form submission. The desired behavior is to have the elements to continue to be triggered while the form submission is in flight. I have tried using
    hx-sync="#myform:queue first"
    , but as described in the docs queues the events to be triggered after the form submission returns. Is there any way that I can have the elements trigger while the form submission is in flight? Thanks!
  • m

    mysterious-toddler-20573

    04/28/2023, 3:15 PM
    yes, what @ripe-action-67367 said (as usual). You want to look for chart elements within
    elt
    rather than globally
  • r

    ripe-action-67367

    04/28/2023, 3:20 PM
    Vanilla form submissions are handled by the browser and cause full page refresh, which among other things will unload running JS. I'm not sure about exact timings when this happens, but if I understand your case correctly, this can't be fixed by htmx
  • m

    mysterious-toddler-20573

    04/28/2023, 3:21 PM
    can you link to this issue, I'll fix it today 😑
  • r

    ripe-action-67367

    04/28/2023, 3:21 PM
    https://github.com/bigskysoftware/htmx/issues/1413
1...110711081109...1146Latest