mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-17 13:06:34 +02:00
Documentation
This commit is contained in:
parent
5817ce3a0f
commit
104ef9954a
25
README.md
25
README.md
|
@ -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).
|
||||
|
|
Loading…
Reference in a new issue