The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Small jQuery plugin dilemma Reply To: Small jQuery plugin dilemma


Duplicate ids are invalid, but that doesn’t always matter. Different browsers do different things, but I think the main problem you’d have would be with javascript: getElementById usually (in most browsers, AFAIK) only returns the first match. So, there’s potential for conflicting code and general funkyness if the user tries to attach some other functionality to the id

Sorry; I don’t really have a suggestion. Your best bet, I think, is #1, combined with a big warning against giving the menu an id in your README.

Maybe you could mix a little bit of #2 in there by logging a warning in the console when you find an id.