Issue
I'm wondering if it's possible to enable multiple trigger types for HTMX. What I want to do is to trigger HTMX on either content change or page load. So far, if I include both trigger types in hx-trigger
, only the first trigger is executed; so in the example below, HTMX is triggered only upon content change.
<select name="area" id="area" hx-post="/api/search" hx-trigger="change load" hx-target="#neighborhood" class="block">
<option>eby</option>
<option>nby</option>
<option>pen</option>
<option>sfc</option>
<option>scz</option>
<option>sby</option>
</select>
Solution
It's as simple as comma-separating your trigger types:
<select name="area" id="area" hx-post="/api/search" hx-trigger="change, load" hx-target="#neighborhood" class="block">
<option>eby</option>
<option>nby</option>
<option>pen</option>
<option>sfc</option>
<option>scz</option>
<option>sby</option>
</select>
Answered By - irahorecka
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.