[fix #2247] linked drop down list: fix js scope pb
This commit is contained in:
parent
d47d0da496
commit
106263f5e7
1 changed files with 6 additions and 6 deletions
|
@ -1,14 +1,14 @@
|
||||||
document.addEventListener('turbolinks:load', function() {
|
document.addEventListener('turbolinks:load', function() {
|
||||||
var primaries, i, primary, secondary, secondaryOptions;
|
var primaries, i;
|
||||||
|
|
||||||
primaries = document.querySelectorAll('select[data-secondary-options]');
|
primaries = document.querySelectorAll('select[data-secondary-options]');
|
||||||
for (i = 0; i < primaries.length; i++) {
|
for (i = 0; i < primaries.length; i++) {
|
||||||
primary = primaries[i];
|
primaries[i].addEventListener('change', function(e) {
|
||||||
secondary = document.querySelector('select[data-secondary-id="' + primary.dataset.primaryId + '"]');
|
var option, options, element, primary, secondary, secondaryOptions;
|
||||||
secondaryOptions = JSON.parse(primary.dataset.secondaryOptions);
|
|
||||||
|
|
||||||
primary.addEventListener('change', function(e) {
|
primary = e.target;
|
||||||
var option, options, element;
|
secondary = document.querySelector('select[data-secondary-id="' + primary.dataset.primaryId + '"]');
|
||||||
|
secondaryOptions = JSON.parse(primary.dataset.secondaryOptions);
|
||||||
|
|
||||||
while ((option = secondary.firstChild)) {
|
while ((option = secondary.firstChild)) {
|
||||||
secondary.removeChild(option);
|
secondary.removeChild(option);
|
||||||
|
|
Loading…
Reference in a new issue