I'm trying to select this element which has square brackets in the name attribute:
<input type="text" name="inputName[]" value="someValue">
I've tried this (which doesn't work):
$('input[inputName[]=someValue]')
and neither does this:
$('input[inputName[]=someValue]')
or this:
$('input["inputName[]"=someValue]')
EDIT: As some of you have pointed out, $('input[inputName=someValue]')
would never work. What I was trying to do was: $('input[name=inputName][value=someValue]')
. (But with []
in the name attribute).
Per the jQuery documentation, try this:
$('input[inputName\\[\\]=someValue]')
[EDIT] However, I'm not sure that's the right syntax for your selector. You probably want:
$('input[name="inputName[]"][value="someValue"]')