3

I have few text boxes whose ids are A_NAME{0}, A_NAME{1}, A_NAME{2}. I am not able access these textboxes values.

I used below command to access them.

$('#A_NAME{0}').val();

Can someone please help.

yuvi
  • 18,155
  • 8
  • 56
  • 93

1 Answers1

6

You need to escape brackets for this:

$('#A_NAME\\{0\\}').val();
          ^^  ^^

jsFiddle

antyrat
  • 27,479
  • 9
  • 75
  • 76
  • 3
    Related documentation: http://api.jquery.com/category/selectors/ "*To use any of the meta-characters [...] as a literal part of a name, it must be escaped with with two backslashes: \\.*" – Jonathan Lonowski Sep 22 '14 at 15:32