How to selector ID textbox array using jquery

Đạt Hoài picture Đạt Hoài · Oct 19, 2012 · Viewed 12.7k times · Source

I have code HTML

<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!

Answer

st3inn picture st3inn · Oct 19, 2012

You have to escape the brackets with \\

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

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