[jQuery] jQuery won't recognise attribute names containing [square brackets]

[jQuery] jQuery won't recognise attribute names containing [square brackets]


I'm finding it impossible using jQuery to select any attributes with
square brackets in them.
I'm sure most people know PHP uses square brackets within form element
names to submit multi-dimensional arrays, ie:
contact[name]
contact[email]
contact[telephone]
contact[options][option 1]
contact[options][option 2]
contact[options][option 3]
This is read natively by PHP as:
contact => array (
name,
email,
telephone,
options => array(
option 1,
option 2,
option 3
)
)
In a way, jQuery's refusal to recognise square brackets makes sense,
as it leans towards attribute selectors (which are fantastic tools),
but vanilla getDocuementById() works, so I'm wondering why jQuery
hasn't some kind of check for this kind of thing?
In the meantime, does anyone have any "best-practice" workarounds to
this issue, for example for the above data structure?
Combined selectors, e.g.
#contact-email
and separate selectors e.g.
#contact #email
offer different advantages. Has anyone any preferences, and why??
Many thanks,
Dave Stewart