Suppose you have the following input field:
You will recognize this as rails notation for being able to send a collection of user objects to the server in a post. (Other web frameworks use it as well).
If you want to find that input field in jQuery, do:
The trick is to put the string you are looking for in double quotes, which means you then have to wrap the entire jQuery parameter in single quotes.
<input type="text" name="users[][name]" value="John" />
You will recognize this as rails notation for being able to send a collection of user objects to the server in a post. (Other web frameworks use it as well).
If you want to find that input field in jQuery, do:
jQuery( '[name="users[][name]"]' );
The trick is to put the string you are looking for in double quotes, which means you then have to wrap the entire jQuery parameter in single quotes.
Comments
Exactly what I was looking for. Thanks for posting this.