Hacker News new | past | comments | ask | show | jobs | submit login

How does error handling work? If I try to replace the content of some div with a reply I get using htmx, but the request fails or times out etc., what content is then put into the div? What if the reply is not valid HTML?

Sorry for the newb and lazy questions.




htmx doesn't do anything on an error by default, but you can override this behavior using the extensive event system it has:

https://htmx.org/events/#htmx:responseError


It’s pretty simple to use the htmx events on the Response to handle errors dialogs or other behavior




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: