Added JavaScript to restore selected options (easier than making it work
in Mustache).
This commit is contained in:
18
js/frs.js
Normal file
18
js/frs.js
Normal file
@ -0,0 +1,18 @@
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
var all_selects = document.getElementsByTagName('select');
|
||||
for (var i in all_selects) {
|
||||
if (!all_selects.hasOwnProperty(i)) {
|
||||
continue;
|
||||
}
|
||||
var xsel = all_selects[i];
|
||||
var xvalue = xsel.dataset.value;
|
||||
//console.log('Value of %o = %o', xsel, xvalue);
|
||||
// Walk all options, compare to desired value and set if matches
|
||||
for (var o in xsel.options) {
|
||||
if (xsel.options[o].value == xvalue) {
|
||||
xsel.selectedIndex = o;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user