DefinitelyTyped/types/chosen-js/chosen-js-tests.ts
denisname 2f5d1477b9 Chosen.js update types for v1.8.5 (#25238)
Add new options: group_search, hide_results_on_select, rtl
Activate `strictNullChecks`
Remove colon after `@default`
Add jsDoc to `on` and `trigger` function
Add line return before jsDoc first line
Remove all exception rules to tslint (unified-signatures,
max-line-length)
2018-04-24 15:54:31 -07:00

34 lines
693 B
TypeScript

// Options
$(".my_select_box").chosen();
$(".my_select_box").chosen({});
$(".my_select_box").chosen({
disable_search_threshold: 10,
max_selected_options: 5,
no_results_text: "Oops, nothing found!",
width: "95%"
});
$(".chosen-select").chosen({
rtl: true
});
// Destroy
$(".my_select_box").chosen("destroy");
// Triggered Events
$(".my_select_box").on("change", (evt, params) => {
evt.preventDefault();
const s: string = params.selected;
const d: string = params.deselected;
console.log(s, d);
});
$(".chosen-select").on("chosen:maxselected", () => {
alert("Max selected");
});
// Triggerable Events
$(".my_select_box").trigger("chosen:updated");