Actually, according to the HTML 4.01 spec, the "name" attribute on "input" elements[1] is defined as being of type CDATA[2], which is very permissive in the kinds of characters it allows. There is a section in the XHTML 1.0spec that talks about restricting the allowed characters in the "name" attribute[3], but since it's talking about fragment identifiers, I'm not sure whether it applies to form field names or not (that would suck if it did, though).
As for the OP's problem, this has worked beautifully for me: $("input[name='foo[bar][baz]']") // notice the single quotes around foo[bar][baz] [1] http://www.w3.org/TR/html401/interact/forms.html#adef-name-INPUT [2] http://www.w3.org/TR/html401/types.html#type-cdata [3] http://www.w3.org/TR/xhtml1/#h-4.10 On Feb 8, 2008 10:53 AM, Marty Vance <[EMAIL PROTECTED]> wrote: > > All Browsers assign form data variable names according to the name > attribute, not id. > > PHP uses square brackets as a shortcut to automagically build arrays > from the request data. Like Karl said, this is illegal in HTML, and > still seems not allowed in XHTML according to > http://www.w3.org/TR/2008/PER-xml-20080205/#sec-common-syn (XHTML is > XML, remember). > > That section has a paragraph beginning "The ASCII symbols and > punctuation marks, along with a fairly large group of Unicode symbol > characters, are excluded from names...", which leads me to believe > square brackets are still disallowed in XHTML names. The allowed > unicode ranges given exclude the ascii range #x5B to #x7F (square > brackets are #x5B and #x5D). > > Assuming I'm reading the spec correctly. Most of the expanded > characters in XML seem to be in a much higher range than ascii. > > Personally, I wish PHP didn't do this with square brackets. > > On Feb 7, 2008 4:29 PM, Dave Stewart <[EMAIL PROTECTED]> > wrote: > > > > OK - this is the best I could come up: > > > > function $$(selector, context){ > > return jQuery(selector.replace(/(\[|\])/g, '\\$1'), > > context) > > } > > > > $$('#contact[email]') > > > > It adds to the global namespace (so won't work with prototype for > > example, which also uses $$) but it does do trick. > > > > Thoughts? > > > -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com