diff --git a/assets/scripts/dist/bundle.js b/assets/scripts/dist/bundle.js index 7c94d8d..d6c5620 100644 --- a/assets/scripts/dist/bundle.js +++ b/assets/scripts/dist/bundle.js @@ -1 +1 @@ -!function(e){function t(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return e[i].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="/assets/scripts/dist/",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o,r=function(){function e(e,t){for(var n=0;no.children.length&&r():r()}()}},{key:"onFocus",value:function(e){}},{key:"onClick",value:function(e){}},{key:"onChange",value:function(e){}},{key:"addEventListeners",value:function(e){e.addEventListener("click",this.onClick),e.addEventListener("keydown",this.onKeyDown),e.addEventListener("change",this.onChange),e.addEventListener("focus",this.onFocus),e.addEventListener("blur",this.onBlur)}},{key:"removeEventListeners",value:function(e){e.removeEventListener("click",this.onClick),e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("change",this.onChange),e.removeEventListener("focus",this.onFocus),e.removeEventListener("blur",this.onBlur)}},{key:"setPlaceholder",value:function(){}},{key:"setValue",value:function(){}},{key:"getValue",value:function(){}},{key:"getPlaceholder",value:function(){}},{key:"search",value:function(){}},{key:"updateInputValue",value:function(e,t){this.options.debug&&console.debug("Update input value");var n=e.parentNode.querySelector(".choice__input--hidden"),i=""!==n.value&&(0,a.isType)("Array",JSON.parse(n.value))?JSON.parse(n.value):[];i.push(t),n.value=JSON.stringify(i)}},{key:"addItem",value:function(e,t,n){this.options.debug&&console.debug("Add item");var i=document.createElement("li");i.classList.add("choice__item"),i.textContent=t,n.appendChild(i)}},{key:"removeItem",value:function(){}},{key:"removeAllItems",value:function(){}},{key:"createItemList",value:function(){}},{key:"init",value:function(){this.supports||console.error("Your browser doesn'nt support shit"),this.initialised=!0;for(var e=this.elements,t=e.length-1;t>=0;t--){var n=e[t];this.render(n)}}},{key:"render",value:function(e){var t=this;this.options.debug&&console.debug("Render");var n=document.createElement("div"),i=document.createElement("input"),o=document.createElement("ul");if(n.classList.add("choice","choice--active"),e.classList.add("choice__input","choice__input--hidden"),e.tabIndex="-1",e.setAttribute("style","display:none;"),e.setAttribute("aria-hidden","true"),(0,a.wrap)(e,n),o.classList.add("choice__list"),""!==e.value){var r=JSON.parse(e.value);r.map(function(n){t.addItem(e,n,o)})}i.type="text",i.classList.add("choice__input","choice__input--cloned"),n.appendChild(o),n.appendChild(i),this.addEventListeners(i)}},{key:"destroy",value:function(){this.options=null,this.elements=null;for(var e=this.elements,t=e.length-1;t>=0;t--){var n=e[t];this.removeEventListeners(n)}}}]),e}(),n=new t;n.init()})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=(t.capitalise=function(e){return e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})},t.isType=function(e,t){var n=Object.prototype.toString.call(t).slice(8,-1);return void 0!==t&&null!==t&&n===e},t.whichTransitionEvent=function(){var e,t=document.createElement("fakeelement"),n={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in n)if(void 0!==t.style[e])return n[e]},t.whichAnimationEvent=function(){var e,t=document.createElement("fakeelement"),n={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"};for(e in n)if(void 0!==t.style[e])return n[e]});t.getParentsUntil=function(e,t,n){for(var i=[];e&&e!==document;e=e.parentNode){if(t){var o=t.charAt(0);if("."===o&&e.classList.contains(t.substr(1)))break;if("#"===o&&e.id===t.substr(1))break;if("["===o&&e.hasAttribute(t.substr(1,t.length-1)))break;if(e.tagName.toLowerCase()===t)break}if(n){var r=n.charAt(0);"."===r&&e.classList.contains(n.substr(1))&&i.push(e),"#"===r&&e.id===n.substr(1)&&i.push(e),"["===r&&e.hasAttribute(n.substr(1,n.length-1))&&i.push(e),e.tagName.toLowerCase()===n&&i.push(e)}else i.push(e)}return 0===i.length?null:i},t.wrap=function(e,t){return t=t||document.createElement("div"),e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t),t.appendChild(e)},t.getSiblings=function(e){for(var t=[],n=e.parentNode.firstChild;n;n=n.nextSibling)1===n.nodeType&&n!==e&&t.push(n);return t},t.findAncestor=function(e,t){for(;(e=e.parentElement)&&!e.classList.contains(t););return e},t.debounce=function(e,t,n){var i;return function(){var o=this,r=arguments,a=function(){i=null,n||e.apply(o,r)},s=n&&!i;clearTimeout(i),i=setTimeout(a,t),s&&e.apply(o,r)}},t.getElemDistance=function(e){var t=0;if(e.offsetParent)do t+=e.offsetTop,e=e.offsetParent;while(e);return t>=0?t:0},t.getElementOffset=function(e,t){var n=t;return n>1&&(n=1),n>0&&(n=0),Math.max(e.offsetHeight*n)},t.getScrollPosition=function(e){return"bottom"===e?Math.max((window.scrollY||window.pageYOffset)+(window.innerHeight||document.documentElement.clientHeight)):window.scrollY||window.pageYOffset},t.isInView=function(e,t,n){return this.getScrollPosition(t)>this.getElemDistance(e)+this.getElementOffset(e,n)},t.stripHTML=function(e){var t=document.createElement("DIV");return t.innerHTML=e,t.textContent||t.innerText||""},t.addAnimation=function(e,t){var i=n(),o=function r(){e.classList.remove(t),e.removeEventListener(i,r,!1)};e.classList.add(t),e.addEventListener(i,o,!1)},t.getRandomNumber=function(e,t){return Math.floor(Math.random()*(t-e)+e)}}]); \ No newline at end of file +!function(e){function t(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return e[i].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="/assets/scripts/dist/",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;ni;i++){var o=arguments[i];(0,a.isType)("Object",o)?n(o):console.error("Custom options must be an object")}return e}},{key:"isOpen",value:function(){}},{key:"isDisabled",value:function(){}},{key:"isEmpty",value:function(){}},{key:"clearInput",value:function(){this.input.value&&(this.input.value="")}},{key:"onKeyDown",value:function(e){var t=this;if(13===e.keyCode&&e.target.value&&!function(){var e=t.input.value,n=function(){t.addItem(e),t.updateInputValue(e),t.clearInput(t.element)};t.options.maxItems?t.options.maxItems>t.list.children.length&&n():n()}(),8===e.keyCode&&!e.target.value){var n=function(){var e=t.list.children[t.list.children.length-1];e.parentNode.removeChild(e)};n(),e.preventDefault()}}},{key:"onFocus",value:function(e){}},{key:"onClick",value:function(e){}},{key:"onChange",value:function(e){}},{key:"addEventListeners",value:function(e){e.addEventListener("click",this.onClick),e.addEventListener("keydown",this.onKeyDown),e.addEventListener("change",this.onChange),e.addEventListener("focus",this.onFocus),e.addEventListener("blur",this.onBlur)}},{key:"removeEventListeners",value:function(e){e.removeEventListener("click",this.onClick),e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("change",this.onChange),e.removeEventListener("focus",this.onFocus),e.removeEventListener("blur",this.onBlur)}},{key:"setPlaceholder",value:function(){}},{key:"setValue",value:function(){}},{key:"getValue",value:function(){}},{key:"getPlaceholder",value:function(){}},{key:"search",value:function(){}},{key:"updateInputValue",value:function(e){this.options.debug&&console.debug("Update input value"),this.valueArray.push(e),this.element.value=JSON.stringify(this.valueArray)}},{key:"addItem",value:function(e){this.options.debug&&console.debug("Add item");var t=document.createElement("li");t.classList.add("choice__item"),t.textContent=e,this.list.appendChild(t)}},{key:"removeItem",value:function(){}},{key:"removeAllItems",value:function(){}},{key:"createItemList",value:function(){}},{key:"init",value:function(){this.supports||console.error("Your browser doesn'nt support shit"),this.initialised=!0,this.render(this.element)}},{key:"render",value:function(){var e=this;this.options.debug&&console.debug("Render");var t=document.createElement("div"),n=document.createElement("input"),i=document.createElement("ul");if(t.className="choice choice--active",this.element.classList.add("choice__input","choice__input--hidden"),this.element.tabIndex="-1",this.element.setAttribute("style","display:none;"),this.element.setAttribute("aria-hidden","true"),(0,a.wrap)(this.element,t),i.className="choice__list",n.type="text",n.placeholder=this.element.placeholder,n.className="choice__input choice__input--cloned",t.appendChild(i),t.appendChild(n),this.container=t,this.input=n,this.list=i,""!==this.element.value){var o=JSON.parse(this.element.value);o.forEach(function(t){e.addItem(t)})}this.addEventListeners(this.input)}},{key:"destroy",value:function(){this.options=null,this.element=null,this.removeEventListeners(this.input)}}]),e}();window.addEventListener("load",function(){for(var e=document.querySelectorAll("[data-choice]"),t=e.length-1;t>=0;t--){var n=e[t],i=new s({element:n});i.init()}})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=(t.capitalise=function(e){return e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})},t.isType=function(e,t){var n=Object.prototype.toString.call(t).slice(8,-1);return void 0!==t&&null!==t&&n===e},t.whichTransitionEvent=function(){var e,t=document.createElement("fakeelement"),n={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in n)if(void 0!==t.style[e])return n[e]},t.whichAnimationEvent=function(){var e,t=document.createElement("fakeelement"),n={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"};for(e in n)if(void 0!==t.style[e])return n[e]});t.getParentsUntil=function(e,t,n){for(var i=[];e&&e!==document;e=e.parentNode){if(t){var o=t.charAt(0);if("."===o&&e.classList.contains(t.substr(1)))break;if("#"===o&&e.id===t.substr(1))break;if("["===o&&e.hasAttribute(t.substr(1,t.length-1)))break;if(e.tagName.toLowerCase()===t)break}if(n){var a=n.charAt(0);"."===a&&e.classList.contains(n.substr(1))&&i.push(e),"#"===a&&e.id===n.substr(1)&&i.push(e),"["===a&&e.hasAttribute(n.substr(1,n.length-1))&&i.push(e),e.tagName.toLowerCase()===n&&i.push(e)}else i.push(e)}return 0===i.length?null:i},t.wrap=function(e,t){return t=t||document.createElement("div"),e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t),t.appendChild(e)},t.getSiblings=function(e){for(var t=[],n=e.parentNode.firstChild;n;n=n.nextSibling)1===n.nodeType&&n!==e&&t.push(n);return t},t.findAncestor=function(e,t){for(;(e=e.parentElement)&&!e.classList.contains(t););return e},t.debounce=function(e,t,n){var i;return function(){var o=this,a=arguments,s=function(){i=null,n||e.apply(o,a)},r=n&&!i;clearTimeout(i),i=setTimeout(s,t),r&&e.apply(o,a)}},t.getElemDistance=function(e){var t=0;if(e.offsetParent)do t+=e.offsetTop,e=e.offsetParent;while(e);return t>=0?t:0},t.getElementOffset=function(e,t){var n=t;return n>1&&(n=1),n>0&&(n=0),Math.max(e.offsetHeight*n)},t.getScrollPosition=function(e){return"bottom"===e?Math.max((window.scrollY||window.pageYOffset)+(window.innerHeight||document.documentElement.clientHeight)):window.scrollY||window.pageYOffset},t.isInView=function(e,t,n){return this.getScrollPosition(t)>this.getElemDistance(e)+this.getElementOffset(e,n)},t.stripHTML=function(e){var t=document.createElement("DIV");return t.innerHTML=e,t.textContent||t.innerText||""},t.addAnimation=function(e,t){var i=n(),o=function a(){e.classList.remove(t),e.removeEventListener(i,a,!1)};e.classList.add(t),e.addEventListener(i,o,!1)},t.getRandomNumber=function(e,t){return Math.floor(Math.random()*(t-e)+e)}}]); \ No newline at end of file diff --git a/assets/scripts/src/choices.js b/assets/scripts/src/choices.js index 79e20e1..f35879f 100644 --- a/assets/scripts/src/choices.js +++ b/assets/scripts/src/choices.js @@ -1,242 +1,287 @@ +'use strict'; + import { wrap, getSiblings, isType } from './lib/utils.js'; -(function (root, factory) { - if (typeof define === 'function' && define.amd) { - define(function() { - return factory(root); - }); - } else if (typeof exports === 'object') { - module.exports = factory; - } else { - root.Choices = factory(root); - } -})(this, function (root) { +class Choices { + constructor(options) { + const fakeEl = document.createElement("fakeelement"); + const USER_OPTIONS = options || {}; + const DEFAULT_OPTIONS = { + element: document.querySelector('[data-choice]'), + disabled: false, + maxItems: 5, + debug: true, + placeholder: false, + callbackOnInit: function(){}, + callbackOnRender: function(){}, + callbackOnKeyUp: function(){}, + callbackOnKeyDown: function(){}, + callbackOnEntry: function(){}, + callbackOnRemove: function(){} + }; - 'use strict'; - - class Choices { - constructor() { - const fakeEl = document.createElement("fakeelement"); - const DEFAULT_OPTIONS = { - element: '[data-choice]', - disabled: false, - maxItems: 5, - debug: true, - placeholder: false, - callbackOnInit: function(){}, - callbackOnRender: function(){}, - callbackOnKeyUp: function(){}, - callbackOnKeyDown: function(){}, - callbackOnEntry: function(){}, - callbackOnRemove: function(){} - }; - - // Merge options with user options - this.options = DEFAULT_OPTIONS; - this.initialised = false; - this.supports = 'querySelector' in document && 'addEventListener' in document && 'classList' in fakeEl; - - // Retrieve elements - this.elements = document.querySelectorAll(this.options.element); - - // Bind methods - this.onClick = this.onClick.bind(this); - this.onKeyDown = this.onKeyDown.bind(this); - this.onChange = this.onChange.bind(this); - this.onFocus = this.onFocus.bind(this); - this.onBlur = this.onChange.bind(this); - } - - /* State */ - - isOpen() { - - } - - isDisabled() { - - } - - isEmpty() { - - } - - clearInput(el) { - if(el.value) el.value = ''; - } - - /* Event handling */ - - onKeyDown(e) { - // Handle enter key - if(e.keyCode === 13 && e.target.value) { - let el = e.target; - let value = el.value; - let list = e.target.parentNode.querySelector('.choice__list'); - - let handleEnterKey = () => { - this.addItem(el, value, list); - this.updateInputValue(el, value); - this.clearInput(el); - }; - - if(this.options.maxItems) { - if(this.options.maxItems > list.children.length) { - handleEnterKey(); - } - } else { - handleEnterKey(); - } - } - } - - onFocus(e) { - - } - - onClick(e) { - - } - - onChange(e) { - - } - - /* Event listeners */ - - addEventListeners(el) { - el.addEventListener('click', this.onClick); - el.addEventListener('keydown', this.onKeyDown); - el.addEventListener('change', this.onChange); - el.addEventListener('focus', this.onFocus); - el.addEventListener('blur', this.onBlur); - } - - removeEventListeners(el) { - el.removeEventListener('click', this.onClick); - el.removeEventListener('keydown', this.onKeyDown); - el.removeEventListener('change', this.onChange); - el.removeEventListener('focus', this.onFocus); - el.removeEventListener('blur', this.onBlur); - } - - /* Methods */ - - setPlaceholder() { - - } - - setValue() { - - } - - getValue() { - - } - - getPlaceholder() { - - } - - search() { - - } - - updateInputValue(el, value) { - if(this.options.debug) console.debug('Update input value'); - // Find hidden element - let hiddenInput = el.parentNode.querySelector('.choice__input--hidden'); - // If input already has values, parse the array, otherwise create a blank array - let valueArray = hiddenInput.value !== '' && isType('Array', JSON.parse(hiddenInput.value)) ? JSON.parse(hiddenInput.value) : []; - // Push new value to array - valueArray.push(value); - // Caste array to string and set it as the hidden inputs value - hiddenInput.value = JSON.stringify(valueArray); - } - - addItem(el, value, list) { - if(this.options.debug) console.debug('Add item'); - // Create new list element - let item = document.createElement('li'); - item.classList.add('choice__item'); - item.textContent = value; - // Append it to list - list.appendChild(item); - } + // Merge options with user options + this.options = this.extend(DEFAULT_OPTIONS, USER_OPTIONS || {}); + this.initialised = false; + this.supports = 'querySelector' in document && 'addEventListener' in document && 'classList' in fakeEl; - removeItem() { + // Retrieve elements + this.element = this.options.element; + // If input already has values, parse the array, otherwise create a blank array + this.valueArray = this.element.value !== '' && isType('Array', JSON.parse(this.element.value)) ? JSON.parse(this.element.value) : []; - } + // Bind methods + this.onClick = this.onClick.bind(this); + this.onKeyDown = this.onKeyDown.bind(this); + this.onChange = this.onChange.bind(this); + this.onFocus = this.onFocus.bind(this); + this.onBlur = this.onChange.bind(this); + } - removeAllItems() { + /** + * Merges unspecified amount of objects into new object + * @private + * @return {Object} Merged object of arguments + */ + extend() { + let extended = {}; + let length = arguments.length; - } + /** + * Merge one object into another + * @param {Object} obj Object to merge into extended object + */ + let merge = function(obj) { + for(let prop in obj) { + extended[prop] = obj[prop]; + } + }; - createItemList() { + // Loop through each passed argument + for(let i = 0; i < length; i++) { + // Store argument at position i + let obj = arguments[i]; - } - - init() { - if(!this.supports) console.error('Your browser doesn\'nt support shit'); - this.initialised = true; - - let els = this.elements; - for (let i = els.length - 1; i >= 0; i--) { - let el = els[i]; - this.render(el); + // If we are in fact dealing with an object, merge it. Otherwise throw error + if(isType('Object', obj)) { + merge(obj); + } else { + console.error('Custom options must be an object'); } } - render(el) { - if(this.options.debug) console.debug('Render'); - - let wrapper = document.createElement('div'); - let input = document.createElement('input'); - let list = document.createElement('ul'); - - wrapper.classList.add('choice', 'choice--active'); - - el.classList.add('choice__input', 'choice__input--hidden'); - el.tabIndex = '-1'; - el.setAttribute('style', 'display:none;'); - el.setAttribute('aria-hidden', 'true'); - - wrap(el, wrapper); - - list.classList.add('choice__list'); - - if(el.value !== '') { - let valueArray = JSON.parse(el.value); - valueArray.map((v) => { - this.addItem(el, v, list); - }); - } - - input.type = 'text'; - input.classList.add('choice__input', 'choice__input--cloned'); - - wrapper.appendChild(list); - wrapper.appendChild(input); - - this.addEventListeners(input); - } - - destroy() { - this.options = null; - this.elements = null; - - let els = this.elements; - - for (let i = els.length - 1; i >= 0; i--) { - let el = els[i]; - - this.removeEventListeners(el); - } - } + return extended; }; - var choices = new Choices(); - choices.init(); + /* State */ + + isOpen() { + + } + + isDisabled() { + + } + + isEmpty() { + + } + + clearInput() { + if(this.input.value) this.input.value = ''; + } + + /* Event handling */ + + onKeyDown(e) { + // Handle enter key + if(e.keyCode === 13 && e.target.value) { + let value = this.input.value; + + let handleEnterKey = () => { + this.addItem(value); + this.updateInputValue(value); + this.clearInput(this.element); + }; + + if(this.options.maxItems) { + if(this.options.maxItems > this.list.children.length) { + handleEnterKey(); + } + } else { + handleEnterKey(); + } + } + + if(e.keyCode === 8 && !e.target.value) { + + let handleBackspaceKey = () => { + let lastItem = this.list.children[this.list.children.length - 1]; + lastItem.parentNode.removeChild(lastItem); + }; + + handleBackspaceKey(); + + e.preventDefault(); + } + } + + onFocus(e) { + + } + + onClick(e) { + + } + + onChange(e) { + + } + + /* Event listeners */ + + addEventListeners(el) { + el.addEventListener('click', this.onClick); + el.addEventListener('keydown', this.onKeyDown); + el.addEventListener('change', this.onChange); + el.addEventListener('focus', this.onFocus); + el.addEventListener('blur', this.onBlur); + } + + removeEventListeners(el) { + el.removeEventListener('click', this.onClick); + el.removeEventListener('keydown', this.onKeyDown); + el.removeEventListener('change', this.onChange); + el.removeEventListener('focus', this.onFocus); + el.removeEventListener('blur', this.onBlur); + } + + /* Methods */ + + setPlaceholder() { + + } + + setValue() { + + } + + getValue() { + + } + + getPlaceholder() { + + } + + search() { + + } + + updateInputValue(value) { + if(this.options.debug) console.debug('Update input value'); + + // Push new value to array + this.valueArray.push(value); + // Caste array to string and set it as the hidden inputs value + this.element.value = JSON.stringify(this.valueArray); + } + + addItem(value) { + if(this.options.debug) console.debug('Add item'); + + // Create new list element + let item = document.createElement('li'); + item.classList.add('choice__item'); + item.textContent = value; + + // Append it to list + this.list.appendChild(item); + } + + removeItem() { + + } + + removeAllItems() { + + } + + createItemList() { + + } + + init() { + if(!this.supports) console.error('Your browser doesn\'nt support shit'); + this.initialised = true; + + this.render(this.element); + } + + render() { + if(this.options.debug) console.debug('Render'); + + // Create DOM elements + let container = document.createElement('div'); + let input = document.createElement('input'); + let list = document.createElement('ul'); + + container.className = 'choice choice--active'; + + // Hide passed input + this.element.classList.add('choice__input', 'choice__input--hidden'); + this.element.tabIndex = '-1'; + this.element.setAttribute('style', 'display:none;'); + this.element.setAttribute('aria-hidden', 'true'); + + // Wrap input in container + wrap(this.element, container); + + list.className = 'choice__list'; + + input.type = 'text'; + input.placeholder = this.element.placeholder; + input.className = 'choice__input choice__input--cloned'; + + container.appendChild(list); + container.appendChild(input); + + this.container = container; + this.input = input; + this.list = list; + + if(this.element.value !== '') { + let initialValues = JSON.parse(this.element.value); + initialValues.forEach((value) => { + this.addItem(value); + }); + } + + this.addEventListeners(this.input); + } + + destroy() { + this.options = null; + this.element = null; + + this.removeEventListeners(this.input); + } +}; + +window.addEventListener('load', function() { + + let choiceInputs = document.querySelectorAll('[data-choice]'); + + for (let i = choiceInputs.length - 1; i >= 0; i--) { + + let input = choiceInputs[i]; + + var choices = new Choices({ + element : input + }); + + choices.init(); + }; }); \ No newline at end of file diff --git a/index.html b/index.html index b75916f..6955574 100644 --- a/index.html +++ b/index.html @@ -5,8 +5,8 @@ Choices - - + + \ No newline at end of file