0

我有这个脚本:

 $(this).before('<span type="text" id="id" name="name" class="tag">' + txt + '</span>');

但在我提交表单后,它并没有出现在 FormCollection 中。我假设 FormCollection 仅包含“ <input type=...>”标签。那么有什么方法可以将我的视图传递<span><label>从我的视图传递给控制器​​吗?

4

2 回答 2

1

不,但您可以传递隐藏的输入:

$(this).before('<input type="hidden" id="id" name="name" value="'+txt+' /><span type="text" id="span_id" name="span_name" class="tag">' + txt + '</span>');

这将添加一个对用户可见的 span 元素和一个对用户隐藏但可以在 FormCollection 中访问的 input 元素

于 2013-07-15T16:19:25.357 回答
0

您可以创建一个 [input type='hidden'] 因此,当您提交表单时,您将标签/跨度值传递给 input hidden

您将在表单集合中看到该组件。

希望这可以帮助。

于 2013-07-15T16:23:22.880 回答