Skip to content

Specify the HTMX select attribute using the URL fragment identifier.

License

Notifications You must be signed in to change notification settings

TheDocTrier/hash-select

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hash-select

Specify HTMX select attribute using the URL fragment identifier. I encourage reading the source hash-select.js since it contains only 4 significant lines of code. Summarized, if an HTMX request path is given with a fragment identifier #some-id, then this extension will override hx-select with the selector #some-id.

Usage

Load the extension after loading HTMX:

<script src="https://unpkg.com/htmx-ext-hash-select"></script>

Then,

<button hx-post="endpoint#status" hx-swap="outerHTML">Click for Status</button>

Becomes approximately equivalent to

<button hx-post="endpoint#status" hx-select="#status" hx-swap="outerHTML">Click for Status</button>

About

Specify the HTMX select attribute using the URL fragment identifier.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published