开发者

Should I always generate a unique Id and Name for every <input> element I submit?

I always generate unique id and name for every input I want to submit,

<input name='text1'/>
<input name='text2'/&g开发者_C百科t; 

However I feel like using name array is more comfortable.

<input name='text[]'/>
<input name='text[]'/>

Does name array have identity problem or any other con?


If you use PHP, the array you get when using [] is very convenient to gather fields of similar type.

From a javascript point of view, there are no issues other than the slight inconvenience to use form["text[]"] or form.elements["text[]"] to access the fields

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜