Q:

How to select all input with given name if name contains [ and ]?

How to select all input with given name if name contains [ and ]?
$('input[name=field_name[array_key]]').removeClass('selected');

Console:

Uncaught Syntax error, unrecognized expression: [name=field_name[array_key]]

Thank you for answers!

A:

Put the name value in quotes:  
$('input[name="field_name[array_key]"]').removeClass('selected');

As stated by the jQuery docs:

Quotes are mandatory

Here's a live example of the above code.

