Home > Article > Web Front-end > js uses for loops and if statements to determine multiple identical name_javascript techniques
var items = document.getElementsByName("spec_spec_1[]"); alert(items.length); for (i = 0; i < items.length; i++) { if(items[i].value==''){ alert('名称不能为空'); } }