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

    mysterious-toddler-20573

    08/17/2022, 3:59 AM
    Is your app going to get crazy interactive?
  • r

    rough-battery-73940

    08/17/2022, 4:00 AM
    No, not really. I think HTMX will be just fine for the app I'm going to be working on
  • r

    rough-battery-73940

    08/17/2022, 4:01 AM
    But I'm also thinking ahead to future projects. learning new libraries is such a time investment. I've been living in backend world, and the last one I learned was jquery and a little backbonejs
  • m

    mysterious-toddler-20573

    08/17/2022, 4:01 AM
    something like alpine has a pretty light touch and still allows for reactive programming where you need it
  • m

    mysterious-toddler-20573

    08/17/2022, 4:01 AM
    and alpine and htmx can pair well together, w/ alpine doing pure front end stuff
  • m

    mysterious-toddler-20573

    08/17/2022, 4:01 AM
    and htmx doing the server communication
  • m

    mysterious-toddler-20573

    08/17/2022, 4:02 AM
    On the other hand: https://www.indeed.com/q-reactjs-jobs.html
  • r

    rough-battery-73940

    08/17/2022, 4:03 AM
    Ohh no lol, I'd rather get kicked in the 🥜 than become a JS dev. No offense 😬
  • m

    mysterious-toddler-20573

    08/17/2022, 4:04 AM
    NB: these jobs have nothing to do w/ htmx, they are for a mexican company
  • m

    mysterious-toddler-20573

    08/17/2022, 4:04 AM
    Well, if you don't want to write a lot of JS, I think htmx and then alpine when needed is probably the least painful way forward
  • m

    mysterious-toddler-20573

    08/17/2022, 4:05 AM
    if you are really brave you can look at https://hyperscript.org, which is sort of an insane next-gen jQuery scripting language we created too
  • r

    rough-battery-73940

    08/17/2022, 4:07 AM
    Interesting.. thanks
  • i

    important-cricket-63511

    08/17/2022, 6:16 AM
    Kind of. Most of my front-end JS functionality is server-initiated (the server ships down little snippets of JS in tags to initialize functionality -- which are essentially encoded RPC calls, similar to
    ->jsCall()
    in XHP if you've ever seen it). Ideally like the same behavior for HTMX, so even if HTMX happens to be part of the JS bundle, it doesn't get turned on until I say so 🙂
  • i

    important-cricket-63511

    08/17/2022, 6:18 AM
    I'm using the NPM bundle if that's any different from the browser bundle, not sure
  • s

    some-hairdresser-28401

    08/17/2022, 11:24 AM
    Is there a way to run a piece of plain js code (calling a function with params is all I want to do) before a htmx request gets send? It needs to be per request, not globally.
  • s

    some-hairdresser-28401

    08/17/2022, 11:29 AM
    I can add a
    onclick
    attribute to the same element or its parent but it feels wrong because I don't know if the will cause timing issues or the like.
  • m

    mysterious-toddler-20573

    08/17/2022, 2:07 PM
    I would probably listen for the
    beforeRequest
    event: https://htmx.org/events/#htmx:beforeRequest
  • s

    some-hairdresser-28401

    08/17/2022, 2:58 PM
    This would be global, right?
  • m

    mysterious-toddler-20573

    08/17/2022, 3:31 PM
    if you want to localize it you'd need to use something like jQuery or VanillaJS and hook up the event listener by id after load. Alternatively you can use something like Alpine or hyperscript to put it on the element in question
  • m

    mysterious-toddler-20573

    08/17/2022, 3:31 PM
    maybe it's time to take the hyperscript pill?
  • r

    rapid-lunch-78326

    08/17/2022, 3:32 PM
    Hi, is it some shortcut for writing this
    Copy code
    <div>
        <p>something static don't want to reload but comes from server</p>
        <div id="test" hx-select="#test" hx-target="#test" hx-swap="outerHTML">
          {% now "jS F Y H:i:s" %}
          <button hx-get="/get-this-html">Update time</button>
        </div>
      </div>
    Exactly this line
    id="test" hx-select="#test" hx-target="#test" hx-swap="outerHTML"
    For example hx-swap="me" 😄
  • m

    mysterious-toddler-20573

    08/17/2022, 3:38 PM
    🙂 not as of now
  • m

    mysterious-toddler-20573

    08/17/2022, 3:38 PM
    I like the hx-swap="me" idea though!
  • t

    tall-dinner-62086

    08/17/2022, 3:39 PM
    You don't have to specify
    hx-target
    if the element is targeting itself, that's the default
  • r

    rapid-lunch-78326

    08/17/2022, 3:46 PM
    Thank you both for help 🙂
  • c

    calm-ice-23682

    08/17/2022, 6:19 PM
    https://campus.w3schools.com/blogs/blog/what-is-appml
  • j

    jolly-kite-167

    08/17/2022, 7:03 PM
    What is the point of blog posts that don't actually link to the tech they describe? https://www.w3schools.com/appml/default.asp
  • b

    brash-house-85887

    08/17/2022, 7:07 PM
    Why does clicking the button add two new items? https://codepen.io/geoffeg/pen/xxWaRGo
  • m

    mysterious-toddler-20573

    08/17/2022, 7:11 PM
    that looks like a bug to me
  • m

    mysterious-toddler-20573

    08/17/2022, 7:11 PM
    I don't see why that should be
1...780781782...1146Latest