js 選擇所有的input下的radio
您可以使用以下方式選擇所有的input下的radio:
var radios = document.querySelectorAll('input[type=radio]');
使用document.querySelectorAll()方法,並指定選擇器為input[type=radio],將返回一個NodeList,其中包含所有input元素的radio類型。 您可以使用此NodeList對所有選定的元素進行操作。
原文地址: https://www.cveoy.top/t/topic/eGtY 著作权归作者所有。请勿转载和采集!