From 497ed5090360aa9b8c6c30b99520bb90b60fc858 Mon Sep 17 00:00:00 2001 From: Josh Johnson Date: Fri, 8 Dec 2017 15:22:51 +0000 Subject: [PATCH] Update example --- index.html | 47 ++++++++++++++++++++++++----------------------- package.json | 1 + 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/index.html b/index.html index 7d0d2f8..862e539 100644 --- a/index.html +++ b/index.html @@ -258,24 +258,26 @@ -

Below is an example of how you could have two select inputs depend on eachother. 'Boroughs' will only be enabled if - the value of 'States' is 'New York'

- - + + + + + - - + + + + + @@ -474,13 +476,14 @@ shouldSort: false, }); - var states = new Choices(document.getElementById('states')); + var cities = new Choices(document.getElementById('cities')); + var tubeStations = new Choices(document.getElementById('tube-stations')).disable(); - states.passedElement.addEventListener('change', function(e) { - if (e.detail.value === 'New York') { - boroughs.enable(); + cities.passedElement.addEventListener('change', function(e) { + if (e.detail.value === 'London') { + tubeStations.enable(); } else { - boroughs.disable(); + tubeStations.disable(); } }); @@ -521,8 +524,6 @@ }; } }); - - var boroughs = new Choices(document.getElementById('boroughs')).disable(); }); diff --git a/package.json b/package.json index ebaec2d..c12bfe1 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "dependencies": { "classnames": "^2.2.5", "fuse.js": "^2.2.2", + "opn": "^5.1.0", "redux": "^3.3.1" }, "npmName": "choices.js",