I have a simple form with an array in it:
<form id='my_form'>
<input type="text" name="my_array[1]">
<input type="text" name="my_array[5]">
<input type="text" name="my_array[6]">
<input type="text" name="non_array_field">
</form>
As you can see the array keys are specified
How can I get the lenght of this array? I can use javascript or jquery
These only works if the array doesn't have keys:
document.querySelectorAll("[name='my_array[]']").length
document.formName.elements["my_array[]"].length