Could not access item if id has these "{}" curly braces

I have a few text fields with IDs A_NAME{0}

, A_NAME{1}

, A_NAME{2}

. I cannot access these textbox values.

I used the command below to access them.

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

      

Can anyone please help.

+3


source to share


1 answer


To do this, you need to escape the parentheses:

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

      



jsFiddle

+6


source







All Articles