jQuery clone problem

前端 未结 4 919
予麋鹿
予麋鹿 2021-01-18 11:43

I am trying to clone a div and change the names of the input fields in this div. It works great for most of the browsers but IE 7 does not change the name attribute of the i

4条回答
  •  温柔的废话
    2021-01-18 12:02

    If you pan on accessing these as a set when the form is posted then there is no need to change the name - just dont put a value within the brackets and it will be incremented for you when you grab the array on the server side:

    If you need to be able to access each one by index from js you can just use get on the appropriate collection returned by a selector. Or you can assign ID attributes like test_1.

提交回复
热议问题