js 极简获取表单 元素 !

时间:2023-03-09 16:42:35
js 极简获取表单 元素 !
let s =[];
$.each($('#formSearch input'),(m,n)=>{s.push(n)});
//示例获取表单所有 input 下滑线分割的 name 集合。set 去重, concat 平铺。
let res = [...new Set( [].concat(...s.map(m=>m.split('_'))))];
//"", "Co", "Id", "Eq", "OrderNo", "OldNo", "SpecSN", "SupplierName", "SupplierGoodsNo", "Duration", "GrE", "ReceiveTime", "Le", "ReceiveUserName"