I've been using
document.forms[0].fieldname.value
to get values in javascript from a form, but I'd like to use a name to reference the field and not a 0, what would be the equivalent these days since <form name="formname"> isn't compliant?
The forms collection is standard DOM 1, there is nothing wrong with using it.
document.forms.formId.elements.field
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With