htmx
htmx copied to clipboard
Change url of request after element has been loaded
Something like
<button id="foo" hx-get="/whatever"> ... </button>
<script>
foo.setAttribute("hx-get", "/somethingelse");
</script>
Currently, the request url remains /whatever even though the hx-get attribute has been updated
I'm having the same issue; using htmx.process(node) doesn't seem to do anything and won't update its internal cache when the hx-get is triggered.
You can now call htmx.process() on the element to get it to reprocess updated attributes:
<button id="foo" hx-get="/whatever"> ... </button>
<script>
foo.setAttribute("hx-get", "/somethingelse");
htmx.process(foo);
</script>