2021-08-12 17:23:42 -07:00
|
|
|
function buildRadioButton(
|
|
|
|
inputID,
|
|
|
|
inputName,
|
|
|
|
inputValue,
|
|
|
|
sortedBy,
|
|
|
|
sortedBySelector,
|
|
|
|
labelText
|
|
|
|
) {
|
|
|
|
let result = document.createElement("button");
|
|
|
|
|
|
|
|
result.style.display = "flex";
|
|
|
|
result.style.alignItems = "center";
|
|
|
|
result.style.height = "2rem";
|
2021-08-14 07:21:26 -07:00
|
|
|
result.style.margin = ".5rem";
|
2021-08-12 17:23:42 -07:00
|
|
|
|
|
|
|
let inputAttsA = `id=${inputID} type="radio" name=${inputName} value=${inputValue}`;
|
2021-08-16 10:35:36 -07:00
|
|
|
let inputAttsB = `onclick="buildResults()" style="margin:0 1rem 0 0" class=${inputName}`;
|
2021-08-12 17:23:42 -07:00
|
|
|
let inputAttsC = sortedBy === sortedBySelector ? " checked" : "";
|
|
|
|
let resultButtonInput = `<input ${inputAttsA} ${inputAttsB} ${inputAttsC}/>`;
|
|
|
|
|
|
|
|
let resultButtonLabel = `<label for=${inputID}>${labelText}</label>`;
|
|
|
|
|
|
|
|
result.innerHTML = `${resultButtonInput}${resultButtonLabel}`;
|
|
|
|
return result;
|
|
|
|
}
|