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
  • 17,529
  • 7
  • 49
  • 88

1 Answers1

6

You need to escape brackets for this:

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

jsFiddle

antyrat
  • 26,266
  • 9
  • 69
  • 74
  • 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