querySelectorAll doesn't select select boxes with name

I have a form that has multiple select boxes and inputs with a array like name. So I have multiple select boxes with a name personrooms. I would like to get these using this

var personroom=document.querySelectorAll("input[name='personsroom[]']");

            alert(personroom.length)

it gives me null (“0”). But with the same way I can select all input (text) fields. Strange. Can anyone help me? Thanks beforehand

var personroom=document.querySelectorAll("input[name='personroom[]']");

no. name is correct as i wrote.

<select class="form-control" name="personsroom[]">
                                                    <option>Secin...</option>
                                                    @foreach($yers as $val)
                                                        <option value="{!! $val->id !!}">{!! $val->name !!}</option>
                                                    @endforeach
                                                </select>

<select> != <input>

2 Likes

Thank you very much. i understood

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.