https://htmx.org logo
I need to specify the `hx-select` for my error cat...
# htmx-general
w
I need to specify the
hx-select
for my error catching. Is it proper to set
event.detail.select
as below..or more like I do
event.detail.target
? Or is it not possible to do what I want? Seems like neither way works, but I'm not sure if it's due to something else or what
Copy code
document.addEventListener("htmx:beforeSwap", (event) => {
  switch (event.detail.xhr.status) {
    case 403:
    case 404:
    case 500:
      event.detail.shouldSwap = true;
      event.detail.isError = false;
      event.detail.target = htmx.find("#main");
      event.detail.select = "#main";
  }
});
EDIT: Looks like maybe it's not a thing, after inspecting
event.detail
. I think I'm able to get around it with some template changes, but just thought I'd post here to see.