jQuery selector for inputs with square brackets in the name attribute

后端 未结 5 1302
醉梦人生
醉梦人生 2020-11-22 06:18

I\'m trying to select this element which has square brackets in the name attribute:


         


        
5条回答
  •  生来不讨喜
    2020-11-22 06:58

    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"]')
    

提交回复
热议问题