问题
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!
回答1:
You have to escape the brackets with \\
$("#info\\[text1\\]")
see http://api.jquery.com/category/selectors/ (second paragraph)
回答2:
Try it this way.
$('input[id="info[text1]"]')
回答3:
Try this:
$('#info\\[text1\\]');
http://jsfiddle.net/UwrVn/
来源:https://stackoverflow.com/questions/12973281/how-to-selector-id-textbox-array-using-jquery