Are add() and appendChild() the same for select DOM objects?

后端 未结 3 588
暗喜
暗喜 2020-12-10 08:14

I\'m working on a small web application that changes the contents of a select drop-down.

I was wondering if appendChild() and add() both accomplish the same task on

3条回答
  •  孤街浪徒
    2020-12-10 09:15

    I think it should be equivalent, but here you can find a question which remarks the different implementations when you try to work with option groups:

    SELECT box: On IE item is added to OptGroup instead of root. FF ok

    IE fails to add a new option "in the root" when there is already group inside the select element.

提交回复
热议问题