Yep. That did it. Although I could have sworn I already tried that. I
probably tried a single slash or something. This is good to know.
Thanks a bunch!
On Aug 16, 1:26 pm, "Erik Beeson" <[EMAIL PROTECTED]> wrote:
> Try:
>
> $('#scheduleHours\\[' + dayNum + '\\]')
>
> I think you need 1.1.3 for escaping to work right...
>
> --Erik
>
> On 8/16/07, Stuart <[EMAIL PROTECTED]> wrote:
>
>
>
> > I've got a little problem here that would seem simple to sort out but
> > has been rather stubborn. I'm trying to loop through a bunch of hidden
> > text fields and grab their value. They look like so;
>
> > <input type="hidden" id="scheduleHours[0]" name="scheduleHours[0]"
> > value="7.5" />
> > <input type="hidden" id="scheduleHours[1]" name="scheduleHours[1]"
> > value="7.5" />
> > <input type="hidden" id="scheduleHours[2]" name="scheduleHours[n...]"
> > value="7.5" />
>
> > These are the product of a Java Server Faces datalist (Tomahawk
> > component) so there is no way to avoid the array-like notation in the
> > id. I'm just building an array of these values with a for loop:
>
> > var schedule = new Array();
>
> > for (var dayNum = 0; dayNum < counts.days; ++dayNum) {
> > schedule[dayNum] = $('#scheduleHours[' + dayNum + ']').val();
> > }
>
> > The problem is that the jQuery selector $('#scheduleHours[' + dayNum +
> > ']').val() is not matching anything. Could it be possible that the "["
> > and "]" characters are being interpreted by jQuery as being part of
> > the attribute selector syntax like so? $("[EMAIL PROTECTED]").val();
> > I'm taking a guess here that I need to escape the [] chars.
>
> > Anyone have an idea?