How to find duplicate id's in a form?

后端 未结 6 2597
无人及你
无人及你 2021-02-20 13:16

I\'ve created a form with about 800 fields in it. Unknowingly I\'ve given same id for few fields in the form. How to trace them?

6条回答
  •  南旧
    南旧 (楼主)
    2021-02-20 13:46

    I've created an example for you to have a look at, it finds all of the duplicate IDs within a form/element on a page and prints the duplicates ID names to the console.

    The array contains method was taken from this post.

    
        
            

    The above code will output the following:

    Duplicate: a

    Duplicate: d

提交回复
热议问题