我正在使用 htmx 和 hyperscript,我希望在提交时清除下面表单中的所有输入字段:
<form hx-post="/example" hx-target="#table tbody" hx-swap="beforeend"
_="<what should I write here??>">
<label class="control-label" for="firstNameInput">First Name</label>
<input id="firstNameInput" name="firstName" class="form-control" type="text" required placeholder="John"/>
<label class="control-label" for="lastNameInput">Last Name</label>
<input id="lastNameInput" name="lastName" class="form-control" type="text" required placeholder="Doe"/>
<button class="btn btn-primary">Add User</button>
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
我尝试<what should I write here??>用例如on submit put '' into <input/>和on submit put '' into <input[value]/>许多其他组合替换,但我无法完成这项工作。
问:提交表单后如何清除所有输入字段?
尝试用on htmx:afterRequest reset() me