dom - Javascript Get Child Element by Name -
i'm passing var el function. el contains grabbed element (using getelementbyid) , when console.log el in function following:
the problem comes in when seek grab element within of el using:
el.getelementsbyname('fname'); i error:
uncaught typeerror: object #<htmldivelement> has no method 'getelementsbyname'
the getelementsbyname() api @ document object level. it's not htmlelement method.
you utilize queryselectorall() instead:
var fnames = el.queryselectorall('[name=fname]'); it's not supported in older browsers however.
javascript dom children
No comments:
Post a Comment