1
0
mirror of synced 2024-11-22 04:56:08 +03:00

Update docs.md

Fix small issue with sample script.
This commit is contained in:
Anh Pham 2017-10-24 10:40:12 +07:00 committed by GitHub
parent e382d971d6
commit 27a29f21e9

View File

@ -16,7 +16,7 @@ var data = {
text: 'Barn owl'
};
var newOption = new Option(data.name, data.id, false, false);
var newOption = new Option(data.text, data.id, false, false);
$('#mySelect2').append(newOption).trigger('change');
```
@ -32,7 +32,7 @@ if ($('#mySelect2').find("option[value='" + data.id + "']").length) {
$('#mySelect2').val(data.id).trigger('change');
} else {
// Create a DOM Option and pre-select by default
var newOption = new Option(data.name, data.id, true, true);
var newOption = new Option(data.text, data.id, true, true);
// Append it to the select
$('#mySelect2').append(newOption).trigger('change');
}