Documentation

This commit is contained in:
Josh Johnson 2016-08-02 21:14:13 +01:00
parent 5817ce3a0f
commit 104ef9954a

View file

@ -494,7 +494,12 @@ example.setValueByChoice('Two'); // Choice with value of 'Two' has now been sele
### disable();
<strong>Input types affected:</strong> `text`, `select-one`, `select-multiple`
<strong>Usage:</strong> Disable input from selecting further options.
<strong>Usage:</strong> Disables input from accepting new value/sselecting further choices.
### enable();
<strong>Input types affected:</strong> `text`, `select-one`, `select-multiple`
<strong>Usage:</strong> 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
<strong>Usage:</strong> Populate options via a callback.
<strong>Example:</strong>
```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).