Remember also that technically in HTML "id" and "name" attributes
can't contain '[]'s.

    ID and NAME tokens must begin with a letter ([A-Za-z]) and may be
    followed by any number of letters, digits ([0-9]), hyphens ("-"),
    underscores ("_"), colons (":"), and periods (".").

        - http://www.w3.org/TR/html401/types.html#type-name

In XHTML "name" can contain a lot more though. (
http://www.w3.org/TR/2002/REC-xhtml1-20020801/#C_8 )

Browsers have relaxed the HTML rules and allowed "name" to contain
whatever it can contain in XHTML. PHP uses the "name" attribute rather
that "id" and so it gets away with it because the relaxed rules.

Karl Rudd

On Feb 8, 2008 10:14 AM, Dave Stewart <[EMAIL PROTECTED]> wrote:
>
> Wow, that's really useful to know, thanks Karl.
>
> I think I'll just use a regular expression:
>
>         selector = selector.replace(/(\[|\])/g, '\$1')
>
> It would be really useful if this were an option, somehow. My jQuery-
> foo is not all that.
>
> Any ideas, anyone?
> Cheers,
> Dave
>

Reply via email to