My current code is:
<form id="search-form" hx-post="/search-api" hx-target="#search-result"></form>
<div class="search-wrapper">
<div class="material-icons search-button md-8 md-light" role="button" type="submit" form="search-form">search</div>
<div class="search-bar-wrapper">
<textarea name="search" type="text" class="search-bar" id="search-bar" form="search-form" placeholder="search" oninput="autoResize(this)"></textarea>
</div>
</div>
<div id="search-result"></div>
I can't submit the form when I click the div, do I have to add some onclick="htmx.trigger(...)" like that? I can't figure out how the htmx.trigger
function works though.
I didn't figure it out and I just changed the "div" button into an actual button and restyled the button.
Some people say I can just submit the form with JavaScript, but it wouldn't trigger the htmx-post function at all! It would also refresh the page, so that's not it.