getElementById() wildcard

后端 未结 6 2228
北荒
北荒 2020-11-28 11:37

I got a div, and there i got some childnodes in undefined levels.

Now I have to change the ID of every element into one div. How to realize?

I thought, becau

6条回答
  •  鱼传尺愫
    2020-11-28 12:34

    You should not change ID of element to ID of other existing element. It's very wrong, so you better re-think your core logic before going on.

    What are you trying to do exactly?

    Anyway, to get all elements with ID starting with something, use jQuery as suggested before, if you can't it's also possible using pure JavaScript, let us know.

提交回复
热议问题