我正在玩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>我尝试过用<what should I write here??>代替on submit put '' into <input/>和on submit put '' into <input[value]/>以及许多其他的组合,但是我没有完成这项工作。
问:当表单提交时,我如何清除所有输入字段?
发布于 2021-12-02 13:39:59
尝试使用on htmx:afterRequest reset() me
https://stackoverflow.com/questions/70200167
复制相似问题