javascript - 将 .text() 转换为 .val()
问题描述
我有一个复选框列表。选中后,输出进入 id=output 的 div
如何将输出放在我的输入字段中?id=标签
$("#phoneword input").click(function () {
$("#output").text($("#phoneword input:checked").map(function () {
return $(this).val();
}).get().join());
}).click().click();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id="phoneword">
<input type="checkbox" class="form-check-input" name="phoneword" value="1"/>
<input type="checkbox" class="form-check-input" name="phoneword" value="2"/>
<input type="checkbox" class="form-check-input" name="phoneword" value="3"/>
</div>
<input type="text" data-role="tagsinput" class="tags" id="tags">
<div id="output"></div>
解决方案
推荐阅读
- javascript - 查找文本并在单选按钮单击时替换它
- c - libcurl 会话和可选的连接重用
- autofac - Autofac RegisterAssemblyTypes 尝试解析所有公共类型
- typescript - console.log 使用 http get 从 json url 记录数据
- php - 致命错误:无法在第 690 行的 dmp/inc/function.php 中重新声明 contact_us()(之前在 dmp/inc/function.php:690 中声明)
- php - 警告:count():参数必须是数组或对象,在 C:\wamp\www\news13102020\admin\process.php 第 55 行实现 Countable
- android - 使用 materix 变换旋转和翻转 Android Fornt Camera2 图像
- azure - 无法使用 Facebook 访问令牌登录 Azure 应用服务
- prometheus - 不同端口上的重复抓取目标
- excel - 复制范围而不排除自动过滤的行