Skip to content

Latest commit

 

History

History

trigger-load-2

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Load polling using hx-trigger load with delay

This example shows load event trigger (doc) with delay event modifier and hx-swap.

<divhx-get="/htmx" hx-trigger="load delay:1s" hx-swap="outerHTML"></div>

hx-swap="outerHTML tells HTMX to replace the entire target element with the response. You will see at the API that we return the same exect element with additional content. HTMX will them process this new content and make another call in (so on and so forth).

returnResults.Content($"""<div hx-get="/htmx" hx-trigger="load delay:1s" hx-swap="outerHTML">{DateTime.UtcNow}</div>""");
close