mirror of
https://github.com/TrentSPalmer/hugo_themes_report.git
synced 2025-07-12 05:23:15 -07:00
add buttons over checks and radios
This commit is contained in:
24
templates/js/buildButton.js
Normal file
24
templates/js/buildButton.js
Normal file
@ -0,0 +1,24 @@
|
||||
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";
|
||||
|
||||
let inputAttsA = `id=${inputID} type="radio" name=${inputName} value=${inputValue}`;
|
||||
let inputAttsB = `onclick="buildResults()" style="margin:0 1rem 0 0"`;
|
||||
let inputAttsC = sortedBy === sortedBySelector ? " checked" : "";
|
||||
let resultButtonInput = `<input ${inputAttsA} ${inputAttsB} ${inputAttsC}/>`;
|
||||
|
||||
let resultButtonLabel = `<label for=${inputID}>${labelText}</label>`;
|
||||
|
||||
result.innerHTML = `${resultButtonInput}${resultButtonLabel}`;
|
||||
return result;
|
||||
}
|
Reference in New Issue
Block a user