diff --git a/www/js/crel.min.js b/www/js/crel.min.js index 25d8e2e..4fe1736 100644 --- a/www/js/crel.min.js +++ b/www/js/crel.min.js @@ -9,10 +9,13 @@ crel.attrMap['options'] = function(element, values, a, b) { if(element.tagName != "SELECT") { return; } + + + let selectedValue = element.value ? element.value : element.attributes.value.value; if(Array.isArray(values)) { for (let option of values) { - if(element.value == option) { + if(selectedValue == option) { element.appendChild(crel('option', {'selected': 'selected'}, option)); } else { element.appendChild(crel('option', option)); @@ -20,7 +23,7 @@ crel.attrMap['options'] = function(element, values, a, b) { } } else { for (let option in values) { - if(element.value == option) { + if(selectedValue == option) { element.appendChild(crel('option', {'selected': 'selected','value': option}, values[option])); }else{ element.appendChild(crel('option', {'value': option}, values[option]));