htmx icon indicating copy to clipboard operation
htmx copied to clipboard

Can you select content from the fetched HTML before swapping?

Open tronicboy1 opened this issue 1 year ago • 1 comments

Hello! Happy holidays.

Is it possible to have selectors on the HTML content you want to swap from a response?

I see that we can use selectors to tell HTMX where we want it to swap in the current DOM, but what about that of the fetched HTML?

tronicboy1 avatar Dec 25 '23 06:12 tronicboy1

Hello! Happy holidays to you too.

I think hx-select can be used for your usecase, it can be used to only swap in part of the response (using selectors). It is the 'opposite' of hx-target which tells HTMX where to put the response.

itepastra avatar Dec 25 '23 19:12 itepastra

@itepastra That was it!! Thank you for your help, really enjoy the philosophy behind htmx.

tronicboy1 avatar Dec 27 '23 00:12 tronicboy1