2016-09-17 45 views
0

我在console.log中获取NodeList的下面。如何获得NodeList参数

NodeList[input#p_method_checkmo.radio.validation-passed attribute value = "checkmo", input#p_method_ccsave.radio.validation-passed attribute value = "ccsave"] 

任何人都可以请告诉我怎么得到这个值ccsave

回答

2

将其转换为阵列的第一

Array.prototype.slice.call(nodelist); 

从最后一个项目获得最后的数组项

Array.prototype.slice.call(nodelist).pop(); 

获取值属性

Array.prototype.slice.call(nodelist).pop().value;