mirror of
https://github.com/Choices-js/Choices.git
synced 2024-06-03 06:22:25 +02:00
Add jQuery example to documentation
This commit is contained in:
parent
6a6988f71b
commit
677d3a5582
|
@ -23,6 +23,9 @@ A lightweight, configurable select box/text input plugin. Similar to Select2 and
|
|||
const choices = new Choices('[data-choice']);
|
||||
const choices = new Choices('.js-choice');
|
||||
|
||||
// Pass jQuery element
|
||||
const choices = new Choices($('.js-choice')[0]);
|
||||
|
||||
// Passing options (with default options)
|
||||
const choices = new Choices(elements, {
|
||||
items: [],
|
||||
|
|
|
@ -844,8 +844,6 @@ export class Choices {
|
|||
* @private
|
||||
*/
|
||||
_onMouseDown(e) {
|
||||
// If not a right click
|
||||
// if(e.button !== 2) {
|
||||
const activeItems = this.store.getItemsFilteredByActive();
|
||||
const target = e.target || e.touches[0].target;
|
||||
|
||||
|
@ -934,7 +932,6 @@ export class Choices {
|
|||
this.toggleDropdown();
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1603,7 +1600,6 @@ export class Choices {
|
|||
_addEventListeners() {
|
||||
document.addEventListener('keyup', this._onKeyUp);
|
||||
document.addEventListener('keydown', this._onKeyDown);
|
||||
// document.addEventListener('touchstart', this._onMouseDown);
|
||||
document.addEventListener('mousedown', this._onMouseDown);
|
||||
document.addEventListener('mouseover', this._onMouseOver);
|
||||
|
||||
|
@ -1625,7 +1621,6 @@ export class Choices {
|
|||
_removeEventListeners() {
|
||||
document.removeEventListener('keyup', this._onKeyUp);
|
||||
document.removeEventListener('keydown', this._onKeyDown);
|
||||
// document.removeEventListener('touchstart', this._onMouseDown);
|
||||
document.removeEventListener('mousedown', this._onMouseDown);
|
||||
document.removeEventListener('mouseover', this._onMouseOver);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
|
||||
<title>Choices</title>
|
||||
<meta name=description itemprop=description content="A lightweight, configurable select box/text input plugin. Similar to Select2 and Selectize but without the jQuery dependency.">
|
||||
|
||||
|
|
Loading…
Reference in a new issue