Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 来自复选框值的动态文本_Jquery_Html - Fatal编程技术网

Jquery 来自复选框值的动态文本

Jquery 来自复选框值的动态文本,jquery,html,Jquery,Html,有人请帮我从复选框中获取id,并用简单的jQuery代码将其放在href项上吗 <a href="edit?id=dynamicText">Edit</a> <a href="delete?id=dynamicText">Delet</a> 在我点击复选框之后 <input type="checkbox" name="mycheck" id="1"> <input type="checkbox" name="mycheck"

有人请帮我从复选框中获取id,并用简单的jQuery代码将其放在
href
项上吗

<a href="edit?id=dynamicText">Edit</a>
<a href="delete?id=dynamicText">Delet</a>

在我点击复选框之后

<input type="checkbox" name="mycheck" id="1">
<input type="checkbox" name="mycheck" id="2">
<input type="checkbox" name="mycheck" id="3">

下面是一个在选中复选框时添加ID的示例。让我知道这是否有帮助

$(文档).ready(函数(){
$edit=$(“#edit”);
$checkedboxs=[];
//仅用于编辑链接
$('input[type=“checkbox”]”)。在('change',函数(e)上{
如果(例如,选中目标)
$checkedboxs.push(例如target.id);
其他的
$checkedboxs.pop(例如target.id);
$edit.attr('href','edit?id='+$checkedboxs.join('&');
console.log('href:',$edit.attr('href');
})
})

在我点击复选框之后

<input type="checkbox" name="mycheck" id="1">
<input type="checkbox" name="mycheck" id="2">
<input type="checkbox" name="mycheck" id="3">

您必须先在您的终端尝试一些代码。这不是一个代码编写平台。我们将帮助您更正代码。您到目前为止尝试了什么?单击要在href上放置ID的复选框?ans选择多个复选框如何?使用复选框的
值将更有意义