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).
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…