答案 0 :(得分:1)
如果您想要回发,请创建隐藏的input
元素:
<input type="text" class="product-input js-product-tags" placeholder="Computer, devices, smartphone" />
<input type="hidden" name="tags" value="CPU" />
<input type="hidden" name="tags" value="RAM" />
<input type="hidden" name="tags" value="HARDWARE" />
<ul class="js-tags">
<li class="tag-options">
<span>CPU</span><div class="remove-tag js-remove-tag">X</div>
<span>RAM</span><div class="remove-tag js-remove-tag">X</div>
<span>HARDWARE</span><div class="remove-tag js-remove-tag">X</div>
</li>
</ul>
... tags
中的name="tags"
是您的参数名称:
[HttpPost]
public ActionResult Create(ICollection<string> tags) {
// ...
}