[] 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. > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---