Search code examples
jqueryjquery-selectorsselectortextinput

How to selector ID textbox array using jquery


I have the HTML code

<input id="info[text1]" type="text" value="1"/> <br>
<input id="info[text2]" type="text" value="2"/> <br>

I want to select id='info[text1]' using jquery but I can't, so can you help me?


Solution

  • You have to escape the brackets with \\

    $("#info\\[text1\\]")
    

    see http://api.jquery.com/category/selectors/ (second paragraph)