-
I'm currently triggering an <textarea
name="question"
class="form-control"
rows="4"
></textarea>
<button
id="ask"
type="button"
hx-post="/ask"
hx-target="#content"
hx-indicator="#indicator"
>
Ask
</button> |
Beta Was this translation helpful? Give feedback.
Answered by
andryyy
Apr 11, 2024
Replies: 1 comment 2 replies
-
I figured it out but I'm not yet preventing the new line from showing up in the <textarea>. <textarea
name="question"
hx-trigger="keydown[key==='Enter'&&!shiftKey]"
hx-post="/ask"
hx-target="#content"
hx-indicator="#indicator"
></textarea> |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, you can add
hx-on:keydown="(event.keyCode===13&&!event.shiftKey)?event.preventDefault():null"
. This does allow for Shift + Enter for new lines but send on Enter.