Akhil Gupta
Akhil Gupta

Reputation: 197

How to get NodeList param

I am getting below NodeList in console.log.

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

Can any one please tell how can i get value ccsave from this.

Upvotes: 0

Views: 47

Answers (1)

gurvinder372
gurvinder372

Reputation: 68393

Convert it to array first

Array.prototype.slice.call( nodelist );

get the last array item

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

get value property from the last item

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

Upvotes: 2

Related Questions