时调用输入字段
我想使用一个页面上多个形式引用的输入字段。或者我想使用<input form="form1,form2,form3,form4" type="text" name="name" required autocomplete="off"/><br>
或每次提交每种表格
<table align="center">
<tr>
<td colspan="5" align="center">Group Name:
<input form="form1,form2,form3,form4" type="text" name="name" required autocomplete="off"/><br>
</td>
</tr>
<tr>
<td>
<form id="form1" action="plan.php" method="post">
<input type="hidden" name="number" value="0"><br>
<input type="hidden" name="priceplan" value="25"><br><br>
<input type="submit" value="10 PAX" style="width:100%; margin-top:0px;" class="button">
</form>
</td>
<td>
<form id="form2" action="plan.php" method="post">
<input type="hidden" name="number" value="0"><br>
<input type="hidden" name="priceplan" value="2"><br><br>
<input type="submit" value="10 People" style="width:100%; margin-top:0px;" class="button">
</form>
</td>
<td>
<form id="form3" action="plan.php" method="post">
<input type="hidden" name="number" value="0"><br>
<input type="hidden" name="priceplan" value="3"><br><br>
<input type="submit" value="20 People" style="width:100%; margin-top:0px;" class="button">
</form>
</td>
<td>
<form id="form4" action="plan.php" method="post">
<input type="hidden" name="number" value="0"><br>
<input type="hidden" name="priceplan" value="4"><br><br>
<input type="submit" value="30 People" style="width:100%; margin-top:0px;" class="button">
</form>
</td>
<td>
<form id="form5" action="plan.php" method="post">
<input type="hidden" name="number" value="0"><br>
<input type="hidden" name="priceplan" value="5"><br><br>
<input type="submit" value="40 People" style="width:100%; margin-top:0px;" class="button">
</form>
</td>
</tr>
</table>
我想使用<input form="form1,form2,form3,form4" type="text" name="name" required autocomplete="off"/><br>
或每次提交每种表格
您可以使用javacsript实现这一点,这是一个使用jQuery的示例:
- 首先,您给您的唯一输入一个ID(id =" kilentunput")
- 然后在提交上,您将其附加到表格
$('form').submit(function(e){ e.preventDefault(); $('<input>').attr({ type: 'hidden', id: 'foo', name: 'bar', value: $('#uniqueInput').val() }).appendTo($(this)); })