Page 1 of 1

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

Posted: Wed Dec 27, 2006 1:03 pm
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).

Posted: Wed Dec 27, 2006 1:10 pm
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.