drive mode radio switch

This commit is contained in:
Devaev Maxim
2020-07-19 14:25:54 +03:00
parent faedb829b9
commit ab13399a2a
7 changed files with 122 additions and 15 deletions

View File

@@ -135,6 +135,22 @@ export var tools = new function() {
};
};
this.setOnClickRadio = function(name, callback) {
for (let el of $$$(`input[type="radio"][name="${name}"]`)) {
this.setOnClick(el, callback)
}
};
this.getRadioValue = function(name, value) {
return document.querySelector(`input[type="radio"][name="${name}"]:checked`).value;
};
this.setRadioValue = function(name, value) {
for (let el of $$$(`input[type="radio"][name="${name}"]`)) {
el.checked = (el.value === value);
}
};
this.setProgressPercent = function(el, title, percent) {
el.setAttribute("data-label", title);
$(`${el.id}-value`).style.width = `${percent}%`;