I\'m passing a var el into a function. el contains previously grabbed element (using getElementById) and when I console.log el in the
el
The getElementsByName() API is at the document object level. It's not an HTMLElement method.
getElementsByName()
document
You could use querySelectorAll() instead:
querySelectorAll()
var fnames = el.querySelectorAll('[name=fname]');
It's not supported in older browsers however.