Thanks Nick, Also would not this forum be better without advices like :
"...[] is used for attributes. Use the backslash to escape them for use as part of an id..." And, yes this is not a discussion for this forum, too .. -- DBJ On Apr 15, 11:26 am, "Nick Fitzsimons" <n...@nickfitz.co.uk> wrote: > Indeed; [ and ] are not actually valid characters in an id attribute, > according to HTML 4.01: > <http://www.w3.org/TR/html401/types.html#type-name> > > '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 (".").' > > Just to confuse the issue, [ and ] _are_ permitted in "name" attributes; > whereas "id" attributes are of type "NAME", "name" attributes are of type > "CDATA": > <http://www.w3.org/TR/html401/types.html#type-cdata> > > > > On Wed, April 15, 2009 9:39 am, DBJDBJ wrote: > > > Even better: do not use them at all , as part of an id ... > > > On Apr 14, 6:58 pm, Daniel Friesen <nadir.seen.f...@gmail.com> wrote: > >> [] is used for attributes. Use the backslash to escape them for use as > >> part of an id. > > >> ~Daniel Friesen (Dantman, Nadir-Seen-Fire) > > >> Mat Brennan wrote: > >> > Hi all, > > >> > Not sure if this is even relevant to the development side of the > >> > group. > > >> > I've noticed if i have something such as: > > >> > <input type="text" name="firstname[1]" id="firstname[1]" /> > >> > <input type="text" name="firstname[2]" id="firstname[2]" /> > > >> > And then i use a selector such as > >> > $("#firstname[2]") then nothing is returned; In fact even > >> > document.getElementsById('firstname[2]') will return nothing. I'm not > >> > sure if it's being turned into an array internally or if i'm > >> > misinterpreting how getElementById works but it's been bugging me. > > >> > I dont need a solution on how to select the element i already figured > >> > I could do something like: > >> > $("[id='firstname[2]']"); which works fine but what I am curious to > >> > know is why the behavior is so odd for this type of id. > > >> > Thanks guys, > >> > Much appreciated. > > -- > Nick Fitzsimonshttp://www.nickfitz.co.uk/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---