diff --git a/README.md b/README.md index 59505b8..772ae06 100644 --- a/README.md +++ b/README.md @@ -494,7 +494,12 @@ example.setValueByChoice('Two'); // Choice with value of 'Two' has now been sele ### disable(); Input types affected: `text`, `select-one`, `select-multiple` -Usage: Disable input from selecting further options. +Usage: Disables input from accepting new value/sselecting further choices. + +### enable(); +Input types affected: `text`, `select-one`, `select-multiple` + +Usage: Enables input to accept new values/select further choices. ### ajax(fn); @@ -502,6 +507,24 @@ example.setValueByChoice('Two'); // Choice with value of 'Two' has now been sele Usage: Populate options via a callback. +Example: + +```js +var example = new Choices(element); + +example.ajax(function(callback) { + fetch(url) + .then(function(response) { + response.json().then(function(data) { + callback(data, 'value', 'label'); + }); + }) + .catch(function(error) { + console.log(error); + }); +}); +``` + ## Browser compatibility ES5 browsers and above (http://caniuse.com/#feat=es5).