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

    future-appointment-69775

    05/27/2023, 12:58 PM
    I found that one of the element has duplicate hx-swap and other htmx attributes
  • p

    proud-librarian-99598

    05/27/2023, 2:16 PM
    Am I doing something wrong, or is there something wrong with the demo code from the htmx.org website? I pasted the example demo into jsfiddle and that works fine, but if I just add
    hx-swap="afterend"
    to it, the result is that the number is added 2 times in the HTML for each click of the button:
    Copy code
    <!-- load demo environment -->
    <script src="https://demo.htmx.org"></script>
    
    <!-- post to /foo -->
    <button hx-post="/foo" hx-target="#result" hx-swap="afterend">
        Count Up
    </button> 
    <output id="result"></output>
    
    <!-- respond to /foo with some dynamic content in a template tag -->
    <script>
        globalInt = 0;
    </script>
    <template url="/foo" delay="500"> <!-- note the url and delay attributes -->
        ${globalInt++}
    </template>

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

  • m

    mysterious-toddler-20573

    05/27/2023, 2:18 PM
    IIRC that's an error w/ the demo script 😑
  • p

    proud-librarian-99598

    05/27/2023, 2:23 PM
    Seems like it indeed. If I try it with my actual Java backend, it works fine. Should I create an issue in GitHub for it ?
  • m

    mysterious-toddler-20573

    05/27/2023, 2:54 PM
    sure, I will try to figure it out
  • s

    swift-spring-80795

    05/27/2023, 8:03 PM
    Hello htmx rebels...newbie here assessing htmx for my next project. Has anyone tried htmx with web components library like IBM Carbon or Microsoft Fast? I see some posts (@mammoth-family-48524) that it works with shoelace style components ... Interesting why one would prefer Shoelace style web components (essentially a one-man show, risky) over IBM carbon/Microsoft FAST for your htmx gig?
  • f

    freezing-waitress-26396

    05/27/2023, 8:08 PM
    isn't htmx like a one man show as well with some contributors
  • g

    great-cartoon-12331

    05/27/2023, 8:10 PM
    GitHub shows quite a lot of contributors each ranging anywhere from low to quite moderately high level of contribution
  • s

    swift-spring-80795

    05/27/2023, 8:12 PM
    Yes, but trying to minimize the "one-man-gets-bored-and-abandons-project" risks as much as possible. "There is safety in numbers"! ... Outside of the above though, my question is more about: what do you like in shoelace more that in IBM carbon? Any other advantages that I might be missing?
  • g

    great-cartoon-12331

    05/27/2023, 8:14 PM
    GH also shows 468 forks, and htmx is not that complex of a project. also it's written in JavaScript. there's no dearth of people who could step up and contribute if needed. htmx is also being funded by GitHub and sponsored by JetBrains. it's possible they are giving away their money to people who might get bored and ghost everyone, but somehow i doubt it.
  • s

    swift-spring-80795

    05/27/2023, 8:19 PM
    I think this is going in the wrong direction , let's ignore the "one-man" part in my question . So, 1. Is there a problem of using IBM Carbon and/or Microsoft FAST with HTMX (like shadow dom?), Has anyone tried such combo? 2. If you selected Shoelace components for your htmx project, why - technical and/or aesthetic reasons?
  • r

    ripe-action-67367

    05/27/2023, 8:25 PM
    I don't see a specific blocking issue with using IBM Carbon with htmx
  • r

    ripe-action-67367

    05/27/2023, 8:25 PM
    As long as you can ensure that components are properly initialized on load (which should happen automatically with Web Components), it should just work
  • r

    ripe-action-67367

    05/27/2023, 8:27 PM
    As for why there is not mention of Carbon in this discord, I think it just so happened
  • s

    swift-spring-80795

    05/27/2023, 8:28 PM
    Thanks @ripe-action-67367 !
  • s

    swift-spring-80795

    05/27/2023, 8:31 PM
    Another beginner's question - do you guys use just htmx or end up using htmx+hyperscript? Thinking about taking 2 red pills at the same time...
  • g

    great-cartoon-12331

    05/27/2023, 8:36 PM
    you mean _hyperscript? i am using only htmx with a tiny amount of hand-written JavaScript: https://zettelkit.xyz/static/script.js
  • s

    swift-spring-80795

    05/27/2023, 8:39 PM
    Thanks @great-cartoon-12331 , yes I meant hyperscript..
  • r

    ripe-action-67367

    05/27/2023, 8:47 PM
    _hyperscript is definitely very neat language and you should at least try it. Alpine is another popular choice, it's very useful when you need more of a reactive state management, and I've been looking to check out https://github.com/gnat/surreal at some point
  • s

    swift-spring-80795

    05/27/2023, 8:50 PM
    Thanks @ripe-action-67367 , surreal looks interesting
  • g

    great-cartoon-12331

    05/27/2023, 8:52 PM
    my advice to beginners would be to keep things as simple as possible, and not to add on complexity. https://grugbrain.dev
  • r

    refined-waiter-90422

    05/28/2023, 2:30 AM
    if 1cg "left" htmx, it'd become a buildstep "enriched" typescript project within the hour. I'm surprised the glory days have lasted this long.
  • r

    refined-waiter-90422

    05/28/2023, 2:38 AM
    I don't worry about it because if everyone suddenly disappeared, the htmx codebase is so small and easy to understand that self-maintaining htmx would be a reasonable path forward.
  • r

    refined-waiter-90422

    05/28/2023, 2:39 AM
    That said I don't think 1cg is going anywhere.
  • s

    swift-spring-80795

    05/28/2023, 3:13 AM
    Thanks @refined-waiter-90422 I was more concerned with Shoelace being a 1-man show... And now that the Shoelace creator joined Fontawesome, I have even more concerns. Not much concerned with HTMX, though.
  • m

    mysterious-toddler-20573

    05/28/2023, 3:40 AM
    My oldest son will take over the project when I die
  • g

    great-cartoon-12331

    05/28/2023, 3:41 AM
    i'm watching Succession right now and imagining you trying to claw your way back to being CEO of HTML
  • n

    nice-cpu-16963

    05/28/2023, 8:53 AM
    Hi! I have a form that is updating a div, is there a way to use the htmx-request on that div instead of on the form tag?
  • g

    gray-morning-3453

    05/28/2023, 7:22 PM
    (I am not familiar with mobile app development, so this may be a nonsensical question)- By any chance is there any development going on to somehow incorporate HTMX into mobile apps?
  • p

    prehistoric-air-9306

    05/28/2023, 7:23 PM
    Is there a standard way to use htmx to delete things without a network call? Basically, it'd be nice to be able to use all the nice settling/swapping logic etc Something like this:
    Copy code
    html
    <div>
      <button onclick="this.parentElement.remove()">Delete</button>
    </div>
    The closest I can find is (where /returns-empty is a non-404 endpoint I make that returns an empty string):
    Copy code
    html
    <div class="target">
      <button hx-target=".target" hx-delete="/returns-empty">Delete</button>
    </div>
    But ideally I'd love to be able to skip the request and just do something like this
    Copy code
    html
    <div class="target">
      <button hx-target=".target" hx-response="">Delete</button>
    </div>
    (hx-response is just one idea I had for something that could be used as the value if no hx-get hx-post etc exists, but any method to accomplish the task would work well)
1...11421143114411451146Latest