【发布时间】:2018-08-12 05:02:24
【问题描述】:
我已经在网上寻找了很长时间,但我一直无法找到一个看起来很常见的问题的答案。
基本上我想要做的是提交输入文本,也许还有如果选中一个单选按钮或类似的东西以作为表格中的文本弹出,因为这里是输入和表格的一些照片。
我希望能够按下“+”或“添加”按钮,并将输入中的所有文本添加到表格中,并且如果选中了收音机(checked=true(类似的东西))当我按下添加按钮时显示在表格中。
这是示例照片的 HTML:
<div class="bg">
<button id="droplist-btn" class="droplist-btn">Add By Droplist</button>
<form>
<input type="text" id="item-code-input" class="item-code-input" placeholder=""></input>
<button type="submit" id="add-item" class="add-item">+</button>
<input type="text" id="color-input" placeholder="color"></input>
<select type="text" id="sizes-item-code" class="sizes-item-code">
<option value="Small">Small</option>
<option value="Medium">Medium</option>
<option value="Large">Large</option>
<option value="XLarge">XLarge</option>
<option value="One Size">One Size</option>
</select>
</label>
<label class="switch">
<input type="checkbox">
<span class="slider"></span>
</label>
<label for="switch">Any Color</label>
</form>
<table id="items-table">
<!--<caption>Task</caption>-->
<tr>
<th>Item</th>
<th>Size</th>
<th>Options</th>
</tr>
<tr>
</tr>
</table>
<label id="item-code-label">Item Code</label>
<!-- idk what happened here -->
<label class="radio">.
<input type="radio" checked="checked" name="radio">
<span class="check-item"></span>
</label>
<label id="keyword-label">Keyword</label>
<label class="radio">.
<input type="radio" name="radio">
<span class="check-keyword"></span>
</label>
</div>
<script src="jquery.js"></script>
<script src="items.js"></script>
</body>
</html>
我已尝试将以下两个答案都添加到我的其他脚本中,但它们都没有在这里工作是我不同表的 html:
<table id="proxy-list">
<tr>
<!--<th>Name</th> -->
<th colspan="3">Proxies</th>
</tr>
<tr>
<td>Proxy1:</td>
<td>174.32.116.214:87</td>
<td>
<button class="remove-btn"><div class="thex">x</div></button>
</td>
</tr>
</table>
<input type="text" id="proxy-add-name" placeholder="Name"></input>
<input type="text" id="proxy-add-proxy" placeholder="Proxy"></input>
<button id="proxy-add" onclick="addProxy()">Add</button>
感谢您的任何帮助。
(我知道我的 html 代码很乱,我对 html 非常了解并且还在学习)
(jQuery 是首选,但正如我所说的那样有帮助)
【问题讨论】:
-
你能贴一些你试过的代码吗?
-
$('#items-table').append($('
') var Item = $("#item-code-input").val() .append($ (' ').append(Item)) .append($(' ').append("Large")) .append($(' ').append("任意大小" ))) 类似的东西作为没有变量的测试它不起作用@FrankerZ请edit您的帖子包含您对问题的任何其他信息。避免在 cmets 中添加它,因为它们更难阅读并且更容易删除。帖子的编辑按钮就在帖子标签的下方。也发布一些 HTML,这样我们就可以演示/测试它而无需重新制作示例结构。
标签: javascript jquery html css jquery-ui