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

    red-morning-49661

    12/03/2022, 9:38 AM
    Is there a way to add the event listener on a html element with hyperscript and also extract the value of the header to put into the element??
  • r

    red-morning-49661

    12/03/2022, 9:44 AM
    "`response.headers = { "HX-Trigger": json.dumps({"showMessage": f"'{movie.title}' was added."}) }`"
  • r

    red-morning-49661

    12/03/2022, 9:44 AM
    Frontend:
  • r

    red-morning-49661

    12/03/2022, 9:45 AM
    `MESSAGE`
  • h

    handsome-window-77114

    12/03/2022, 12:17 PM
    Updating attributes is really needed when using web components from third parties (to prevent FOUC https://en.wikipedia.org/wiki/Flash_of_unstyled_content). As a workaround I create a empty div (shadow-webcomponent) inside a container div and add an eventListener to this container on htmx:load. When htmx updates the shadow-webcomponent, the eventListener calls a javascript function to copy the attributes from the shadow-webcomponent to the original webcomponent. "js:doSomething" would be better, but something like idiomorph for attributes would be the best solution IMHO.
  • g

    gray-morning-3453

    12/04/2022, 3:32 AM
    does hx-vals parameter attach a querystring to the get request?
  • g

    gray-morning-3453

    12/04/2022, 3:39 AM
    Found out. Yes, it does.
  • b

    broad-pencil-64390

    12/04/2022, 12:55 PM
    ChatGPT describing htmx
  • j

    jolly-kite-167

    12/04/2022, 5:07 PM
    Untrue (the X part, AFAIK) but a plausible retcon. GPT is a danger.
  • m

    mysterious-toddler-20573

    12/04/2022, 5:08 PM
    htmx stands for extended html
  • j

    jolly-kite-167

    12/04/2022, 5:09 PM
    i wrote a note about that bot last night https://msmprojects.com/2022/12/03/the-model-does.html
  • j

    jolly-kite-167

    12/04/2022, 5:10 PM
    the line between reasoning and faking it is blurry for certain, but it is still there and they aren't the same thing at all
  • j

    jolly-kite-167

    12/04/2022, 5:12 PM
    that lunatic that $GOOG fired who thought their bot had achieved sentience didn't help
  • m

    miniature-lizard-24702

    12/04/2022, 6:55 PM
    but it sounds believable
  • j

    jolly-kite-167

    12/04/2022, 6:58 PM
    And that's the big problem with GPT.
  • m

    miniature-lizard-24702

    12/04/2022, 6:59 PM
    yep. it was a nod to your previous comment
  • m

    miniature-lizard-24702

    12/04/2022, 6:59 PM
    heh
  • m

    miniature-lizard-24702

    12/04/2022, 6:59 PM
    basically, you're right and theres the proof
  • b

    bitter-carpet-58319

    12/04/2022, 7:45 PM
    HTML only beginner [zero JS knowledge] - Reading hx-include documentation, but not understand it. Is CSS somehow related to Cascading Style Sheets? It does not make sense pro me πŸ˜•
  • m

    miniature-lizard-24702

    12/04/2022, 8:37 PM
    what outcome are you trying to achieve?
  • b

    bitter-carpet-58319

    12/04/2022, 9:03 PM
    Nothing specific at this moment, just try to understand HTMX capabilities. In future want to rewrite some old CGI / FRAMES based web sites to SPA to improove its visibility and usability on smart phones.
  • b

    bitter-carpet-58319

    12/04/2022, 9:06 PM
    Understand HTMX is "HTML with some JS capabilities without JS", but its possible to use it without (even elemetary) JS knowledge? I am not a programmer, can do HTML 4 (without CSS) and simple shell scripts for CGI only.
  • a

    able-park-18255

    12/04/2022, 9:14 PM
    doing a little todo app with htmx. can't figure out with my button isn't sending it's value along with the request
    Copy code
    html
    <button class="ml-auto text-red-500" hx-post="/wp-json/wauble/v1/todo/delete/" hx-trigger="click" name="id" value="1" hx-swap="innerHTML" hx-target="#todos-list">Delete</button>
  • m

    miniature-lizard-24702

    12/04/2022, 9:28 PM
    Yes it is
  • m

    miniature-lizard-24702

    12/04/2022, 9:28 PM
    Imo
  • m

    miniature-lizard-24702

    12/04/2022, 9:29 PM
    You can also control some functionality via server headers
  • m

    miniature-lizard-24702

    12/04/2022, 9:29 PM
    On response
  • m

    miniature-lizard-24702

    12/04/2022, 9:29 PM
    Maybe look into #941815579440992337 as well then
  • m

    mammoth-family-48524

    12/04/2022, 9:34 PM
    From the hx-include page > The hx-include attribute allows you to include additional element values in an AJAX request. The way it works for hx-include is you don’t specify the value to include, you specify a form field - like β€˜β€™ - and HTMX will grab the value of that field and include it in the AJAX request to the server. CSS syntax is great at choosing elements to do something in. In a CSS file, CSS syntax is used to choose an element/s to apply a style to. In hx-include, CSS syntax is used to choose an element to get the data from (which HTMX will then get the value of and include it in the AJAX request)
  • m

    mammoth-family-48524

    12/04/2022, 9:45 PM
    Was there a jsfiddle like thing where we could write some HTMX and it would show us what the request final looks like? I thought there was but maybe I dreamt it πŸ˜‚
1...931932933...1146Latest