/    Sign up×
Community /Pin to ProfileBookmark

select and hidden field with same ID??

I saw this on a website, and I’m confused as to what the possible purpose could be for this.

[CODE]
<input id=”myIDNAME” name=”myIDNAME” type=”hidden” value=”0″ />
<input id=”myIDNAME” name=”myIDNAME” type=”checkbox” value=”0″ />
[/CODE]

First of all, I thought repeating an ID would return an error.

Does anyone know a possible purpose for this?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@svidgenMar 30.2011 — To the best of my knowledge, ID's must be unique to nodes. So, the code you posted is, as you suspect, invalid. The browser won't necessarily choke on it, but you'll only be able to refer to a single one of the nodes. Chrome default to the first one -- not sure what other browsers do ...

Definitely bad practice in the very least.
Copy linkTweet thisAlerts:
@irf2kauthorMar 30.2011 — Ye, I thought so. It was just so odd to see on what was an otherwise well designed and neatly coded site, that I thought I might be missing something.

Thanks
Copy linkTweet thisAlerts:
@svidgenMar 30.2011 — Hmm ... what's the url?
×

Success!

Help @irf2k spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...