Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not access the element if id has these "{}"braces

Tags:

jquery

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.

like image 767
Narendiran Purushothaman Avatar asked Nov 28 '25 05:11

Narendiran Purushothaman


1 Answers

You need to escape brackets for this:

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

jsFiddle

like image 73
antyrat Avatar answered Nov 29 '25 22:11

antyrat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!