Today we can writhe huge web pages that contains many user controls, jquery plugins and a lot of html elements.
Sometimes there is a jquery plugin that create a div and assign Id to it. When using this kind of plugin more then one time – the is situation where two elements has the same id.
Does using “name” is better then using “id”?
Plugin that generates same ID for DOM elements by design is not worth using – it shows poor programming. Good plugins will always use unique ID, for example by adding some index.
So, just don’t use such plugins.
Name is not really relevant for elements outside of a web form – for example
<div>should not havename, this attribute is meaningful only for form elements and in this case yes, better use it as you can give same name to more than one element.