I want to select an input with Prototypejs and its $$ function.
I am able to do this :
$$('input')
But I want to be more accurate in my search, with a name of an input. The name of the input I want to select is "array[]" :
$$('input[name="array[]"]')
I think the [ and ] in the name are creating troubles because the result I get are the same as if I did this :
$$('input')
How do i select the inputs having a name such as "something[]" ?
您可以稍微冗长一些,然后使用:
$$('input').findAll(function (o) { return o.name=="array[]"; })
It seems like it was a bug with prototype 1.6.0.3 and probably lower versions.
Works with prototype >= 1.6.1
Are you probably looking for
$$('input[name="array[]"]')[0]
because $$()
returns an array of input elements? Works for me.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.