JQuery create new select option

前端 未结 6 1376
遥遥无期
遥遥无期 2020-12-29 19:46

I have the below functions in regular JavaScript creating select options. Is there a way I can do this with jQuery without having to use the form object? Perhaps storing the

6条回答
  •  一个人的身影
    2020-12-29 19:51

    This is confusing. When you say "form object", do you mean " element. Why do you want to rewrite this code? What you have has worked in all scriptable browsers since around 1996, and won't stop working any time soon. Doing it with jQuery will immediately make your code slower, more error-prone and less compatible across browsers.

    Here's a function that uses your current code as a starting point and populates a

提交回复
热议问题