Javascript Disable form field element by id (id is an array)
<p>I am building a recurring events module to drop into a form, this module has several fields.</p>

<p>I have named and ID'd each of this module using array notation. EG:</p>

<pre><code> id='recurring_event_options[yearly][by_date_day_number]'
</code></pre>

<p>In my JS I need to target all fields with the matching id <code>recurring_event_options</code></p>

<p>I have some JS working nicely that enables (non disabled) fields as needed, but before i run this i need to disable all the fields in this module.</p>

<p>I have been using somthing similar to this to disable the fields:</p>

<pre><code>function disableForm(theform) {
        if (document.all || document.getElementById) {
            for (i = 0; i &lt; theform.length; i++) {
            var formElement = theform.elements[i];
                if (true) {
                    formElement.disabled = true;
                }
            }
        }
    }
</code></pre>

<p>As you can see, that going to hit every field in the form - thats not what i want - only to disable the fields that belong to the <code>recurring_event_options</code> parent ID.</p>

<p>I have a feeling I probably cant use [] notation in IDs, so suggestions welcome!</p>
