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

    mysterious-toddler-20573

    10/26/2020, 2:44 PM
    which will force htmx to issue a request when you navigate back
  • m

    most-jelly-15242

    10/26/2020, 2:44 PM
    Ok, the error I ran into is not due to number of cached requests, it's overall KB size.
  • c

    clean-kitchen-15473

    10/26/2020, 5:37 PM
    How do you use the javascript events? Do you just listen for them on the page or you have to specifically tell tags to fire them?
  • g

    gorgeous-ghost-95789

    10/26/2020, 5:49 PM
    Hi @clean-kitchen-15473 — The events listed on the HTMX website (https://htmx.org/reference/#events) are all fired automatically by the library. You can listen for them in JS code that you write.
  • g

    gorgeous-ghost-95789

    10/26/2020, 5:50 PM
    But, it also works the other way, too. If you fire an event in your own JS code (or via Hyperscript) you can listen for it using the hx -trigger attribute.
  • g

    gorgeous-ghost-95789

    10/26/2020, 5:50 PM
    Does this make sense?
  • c

    clean-kitchen-15473

    10/26/2020, 5:54 PM
    oh yes
  • c

    clean-kitchen-15473

    10/26/2020, 5:54 PM
    that makes sense
  • c

    clean-kitchen-15473

    10/26/2020, 5:54 PM
    hmm that's weird i'm trying to listen for these events, but i'm unable to log them - i'm doing it just after $(document).ready(function() { ...
  • g

    gorgeous-ghost-95789

    10/26/2020, 5:55 PM
    HTML event bubbling is weird. You need to listen for the event in the correct node. It’s easy to mess up, and I usually have to double check / make corrections when I try.
  • g

    gorgeous-ghost-95789

    10/26/2020, 5:58 PM
    I’m not sure how JQuery binds to the events. But you might need to re-initialize that function if you’re listening for events on data that’s been dynamically loaded. Hopefully someone with more experience than me can give you a better answer.
  • m

    mysterious-toddler-20573

    10/26/2020, 6:00 PM
    @User can you post your code?
  • c

    clean-kitchen-15473

    10/26/2020, 6:05 PM
    I'm still using intercooler but this is the tag in question and the javascript
    Copy code
    html
    
    <button 
    type="button"
    class="btn btn-danger btn-sm text-white"
    ic-get-from="ic-currentPestContainer.cfm?action=delete&recordKey=<cfoutput>#qCurrentPests.coi_conKey#</cfoutput>"
    ic-target="#currentPestContainer">
      Deactivate
    </button>
    
    
    <script>
    $(document).ready(function () {
       $('body').on('beforeSend.ic', function(evt, elt, data,       settings, xhr, requestId) { console.log(evt)});
        }
    });
    </script>
  • g

    gorgeous-ghost-95789

    10/26/2020, 6:08 PM
    I miss ColdFusion... HTMX has actually made me wonder if I should go back and make the next project in CFML -- it's just the runtime requirements that keep me from doing it 🙂
  • c

    clean-kitchen-15473

    10/26/2020, 6:09 PM
    ah i dont miss it(like using it i mean)
  • c

    clean-kitchen-15473

    10/26/2020, 6:09 PM
    LOL
  • g

    gorgeous-ghost-95789

    10/26/2020, 6:11 PM
    fair enough 🙂
  • m

    mysterious-toddler-20573

    10/26/2020, 6:56 PM
    @User that looks perfectly reasonable
  • c

    clean-kitchen-15473

    10/26/2020, 7:15 PM
    hm
  • c

    clean-kitchen-15473

    10/26/2020, 7:15 PM
    must be something else im doing wrong then
  • m

    mysterious-toddler-20573

    10/26/2020, 7:52 PM
    can you set a breakpoint in the intercooler javascript?
  • m

    most-jelly-15242

    10/26/2020, 9:17 PM
    Just found a cool service called Mocky to create mock API responses so anyone having problems can easily create a codepen with example code. See here https://codepen.io/jreviews/pen/ZEOeVVX
  • m

    mysterious-toddler-20573

    10/26/2020, 9:22 PM
    awesome!
  • c

    clean-kitchen-15473

    10/26/2020, 9:44 PM
    oh i forgot about breakpoints
  • c

    clean-kitchen-15473

    10/26/2020, 9:44 PM
    ill try that
  • c

    clean-kitchen-15473

    10/26/2020, 9:44 PM
    thanks
  • a

    ancient-soccer-8576

    10/27/2020, 4:12 PM
    Hello, i am sorry, can "hx-include" send multiple vars or only one? Is there an example for multiple html elements?
  • a

    ancient-soccer-8576

    10/27/2020, 4:19 PM
    What I need to do: I have a form with some input and a textarea; I am trying to do 2 things when textarea is changed: 1) every time it is changed and delay passed, save to cloud; 2) every time it is changed, render markup on a div; how can I make 2 things with only 1 trigger?
  • m

    mysterious-toddler-20573

    10/27/2020, 4:45 PM
    @User I would wrap it with a div and put the second behavior on that using
    changed
    as the
    hx-trigger
  • m

    mysterious-toddler-20573

    10/27/2020, 4:45 PM
    or, wait, maybe key-up
1...656667...1146Latest