Tuesday, October 20, 2015

Elements with duplicate IDs in HTML/JS

Elements with duplicate IDs in HTML can be a huge problem to debug. This is due to the fact that no exception will be generated in JS console in this case.

Using JS/jQuery functions on such objects will often result in wrong objects being edited or scanned.

You can , for example, see that your checkbox always returns "unchecked" state in JS, while you are sure that it is clicked in the browser, and so on, and on.

Be sure to clean out all duplicate IDs in your code.

No comments:

Post a Comment

Ubuntu 12.04, 14.04, 16.04 - auto start an app or script before login

To run a command or application at startup, even before the user has logged in, you can use this file: /etc/rc.local The commands entered...