do ids like gender[male] cause problems in javascript?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

do ids like gender[male] cause problems in javascript?

Post by Luke »

If I have a form field with an id of "gender[male]". Will it cause any problems that I should know about when trying to work with it's value via javascript?

Code: Select all

var gender_male = document.getElementById('gender[male]');
and that sort of thing... (obviously my question pertains to more than just that example, but it gives you an idea of what I mean).
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

standards invalid: http://www.w3.org/TR/html4/types.html#type-name

I typically will preg_replace() all "bad" characters with underscores then trim() underscores to remove any outside ones.
Post Reply