현재 버전


const checkTypes = ["cpu", "disk"];

let result = [];

checkTypes.forEach(checkType => {
  let resourceConfig = {};
  let inputs = document.querySelectorAll("input[checktype="+checkType+"]");
for(let i = 0; i < inputs.length; i++){ resourceConfig[inputs[i].getAttribute("name")] = inputs[i].value;
} result.push(resourceConfig); });



수정 이력

2020-07-20 17:28:26 에 아래 내용에서 변경 됨 #4


const checkTypes = ["cpu", "disk"];

let result = [];

checkTypes.forEach(checkType => {
  let resourceConfig = {};
  let inputs = document.querySelectorAll("input[checktype="+checkType+"]");
for(let i = 0; i < inputs.length; i++){ resourceConfig[inputs[i].getAttribute("name")] = inputs[i].value
} result.push(resourceConfig); });


2020-07-20 17:28:14 에 아래 내용에서 변경 됨 #3


const checkTypes = ["cpu", "disk"];

let result = [];

checkTypes.forEach(checkType => {
  let resourceConfig = {};
  let inputs = document.querySelectorAll("input[checktype="+checkType+"]");
for(let i = 0; i < inputs.length; i++){ resourceConfig[inputs[i].getAttribute("name")] = inputs[i].value
} result.push(resourceConfig); });


2020-07-20 17:28:07 에 아래 내용에서 변경 됨 #2


const checkTypes = ["cpu", "disk"];

let result = [];

checkTypes.forEach(checkType => {
  let resourceConfig = {};
  let inputs = document.querySelectorAll("input[checktype="+checkType+"]");
for(let i = 0; i < inputs.length; i++){ resourceConfig[inputs[i].getAttribute("name")] = inputs[i].value
} result.push(resourceConfig); });


2020-07-20 17:27:02 에 아래 내용에서 변경 됨 #1


const checkTypes = ["cpu", "disk"];

let result = [];

checkTypes.forEach(checkType => {
  let resourceConfig = {};
  let inputs = document.querySelectorAll("input[name=searchTypeId]");

  for(let i = 0; i < inputs.length; i++){
    resourceConfig[document.querySelectorAll("[name=searchTypeId]")[0].getAttribute("name")]
      = document.querySelectorAll("[name=searchTypeId]")[0].value
  }

  result.push(resourceConfig);
});