gpt4 book ai didi

javascript - 表单外的语义 UI 提交表单按钮

转载 作者:搜寻专家 更新时间:2023-10-31 08:26:38 25 4
gpt4 key购买 nike

我在通过表单外的按钮提交表单时遇到问题。我需要使用此按钮提交此表单:

<div class="ui submit green labeled icon button">
<i class="checkmark icon"></i>
Create
</div>

但是按钮在外面<div id="addAcredicationForm" class="ui large form">并且不验证表格。按钮必须是 <div class="actions">. 中的外部形式模态对话框的适当页脚。

<div id="addModal" class="ui small modal">
<i class="close icon"></i>
<div class="header">
<div class="column">
<h3 class="ui header">
<i class="bordered inverted blue plus icon"></i>
<div class="content">
XYZ
</div>
</h3>
</div>
</div>
<div class="content">
<div id="addAcredicationForm" class="ui large form">
<div class="ui blue segment">
<div class="field">
<label>Název akreditace</label>
<input type="text" maxlength="40" id="name" name="name" placeholder="aaaa">
</div>
<div class="field">
<label>Poznámka</label>
<textarea rows="5" maxlength="250" id="note" name="note" placeholder="bbbb"></textarea>
</div>
</div>
<div class="ui error message"></div>
</div>
</div>
<div class="actions">
<div class="ui submit green labeled icon button">
<i class="checkmark icon"></i>
Create
</div>
<div class="ui cancel red labeled icon button">
<i class="remove icon"></i>
Cancel
</div>
</div>
</div>

这里是例子:jsfiddle.net/q2hLrm13/1

最佳答案

在 HTML5 中这是可能的,您可以将提交按钮放在表单之外

<form id="submit-form">
...
</form>

<button type="submit" form="submit-form">Submit</button>

关于javascript - 表单外的语义 UI 提交表单按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33758038/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com