如何使用jquery选择ID文本框数组

Đạt*_*oài 9 jquery selector textinput jquery-selectors

我有代码HTML

<input id="info[text1]" type="text" value="1"/> <br>
<input id="info[text2]" type="text" value="2"/> <br>
Run Code Online (Sandbox Code Playgroud)

我想用jquery选择id ='info [text1]',但我不能,所以你可以帮助我!

st3*_*inn 17

你必须用括号转义括号 \\

$("#info\\[text1\\]")
Run Code Online (Sandbox Code Playgroud)

http://api.jquery.com/category/selectors/ (第二段)


hen*_*eee 5

尝试这种方式。

$('input[id="info[text1]"]')
Run Code Online (Sandbox Code Playgroud)