javascript - How to have multiple input boxes of the same name on a page? -
i making web page. has input fields grouped 1 section, , below section "add another" button. button add identical section page using javascript; same form fields.
then later down page there "calculate" button. runs other javascript needs have access these input fields via jquery.
what recommended way have multiple duplicate input
elements on page? aware there shouldn't 2 elements same id, happens 2 elements of same name? can accessed individually? or should name these input elements differently javascript, e.g. adding "1", "2", etc. end of name, , use loops? (that seems messy)
how should identify , access these identical groups of input fields?
you can use document.getelementsbyname('name')
, loop on result each value.
Comments
Post a Comment