Javascript 获取所有输入元素id';,并将其传递给控制器mvc5中的action方法
我需要一些向导, 我想从视图中获取所有输入元素id,并填充此id的 在我的操作中存在的数组中。请帮我弄清楚我该怎么办 这是我的index.cshtml页面代码:Javascript 获取所有输入元素id';,并将其传递给控制器mvc5中的action方法,javascript,html,asp.net-mvc,model-view-controller,Javascript,Html,Asp.net Mvc,Model View Controller,我需要一些向导, 我想从视图中获取所有输入元素id,并填充此id的 在我的操作中存在的数组中。请帮我弄清楚我该怎么办 这是我的index.cshtml页面代码: @{ Layout = null; } <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>Index</titl
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body>
<input type="checkbox" name="parameter" id="1" value="a" />
<input type="checkbox" name="parameter" id="2" value="b" />
<input type="checkbox" name="parameter" id="3" value="c" />
<input type="checkbox" name="parameter" id="4" value="d" />
</body>
</html>
这是我的第二个控制器,我不知道该用它做什么!(我想我应该用这个参数检索我的id)
没有别的了!
我真的需要你的指导。。。
谢谢大家。
document.querySelector(“[id]”)
将返回具有id的所有元素。然后需要将元素映射到它们的id数组。然后去喝咖啡。@taplar谢谢你,taplar,但是你能给我介绍一些与我的问题相对应的关于映射的参考吗?@taplar非常感谢你
public ViewResult Index()
{
return View();
}
public ActionResult action(int AllElementsId)
{
//what should i do here?
return View();
}