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?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
By defualt Notepad++ has syntax highlighting that if you double click one word to select it, it will highlight all other occurences of the same word. You are going to have to do some (probably a lot) of manual work renaming things, I mean since fields can't come up with their own unique name.
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:
One-ish liner using just array methods:
Logs every duplicate and returns an array containing the ids if any were found.
This might help you
Source: Finding duplicate ID’s on an HTML page
There is a Chrome extension named Dup-ID which if you install, you just need to press the button to check duplicated ids. Link of install: https://chrome.google.com/webstore/detail/dup-id-scans-html-for-dup/nggpgolddgjmkjioagggmnmddbgedice
The http://validator.w3.org/ will be the handy solution. But using jquery you can do something like this:
Hope this helps.