简体   繁体   中英

Odd JavaScript getElementsByName undefined error

Okay, I've seriously got to be missing something or I'm crazy. Here's the code I'm having an issue with, it is inside an onchange event:

console.log( (this.parentNode.parentNode) );
// fine prints the elements

console.log( (this.parentNode.parentNode).getElementsByName('otherposition[]') );
// gives me undefined error

(this.parentNode.parentNode).getElementsByName('otherposition[]')[0].style.opacity = '1';
// same error.

getElementsByNamedocument一种方法,元素没有这种方法。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM