{"id":15479849,"url":"https://github.com/gr2m/contenteditable-autocomplete","last_synced_at":"2025-12-12T05:48:01.730Z","repository":{"id":14620355,"uuid":"17337699","full_name":"gr2m/contenteditable-autocomplete","owner":"gr2m","description":"Autocomplete for contenteditable tags","archived":false,"fork":false,"pushed_at":"2021-03-05T06:39:58.000Z","size":655,"stargazers_count":12,"open_issues_count":2,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-19T12:12:02.185Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://gr2m.github.io/contenteditable-autocomplete","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gr2m.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-03-02T12:55:21.000Z","updated_at":"2024-03-21T18:29:47.000Z","dependencies_parsed_at":"2022-08-31T09:12:28.043Z","dependency_job_id":null,"html_url":"https://github.com/gr2m/contenteditable-autocomplete","commit_stats":null,"previous_names":["gr2m/bootstrap-contenteditable-autocomplete"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr2m%2Fcontenteditable-autocomplete","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr2m%2Fcontenteditable-autocomplete/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr2m%2Fcontenteditable-autocomplete/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr2m%2Fcontenteditable-autocomplete/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gr2m","download_url":"https://codeload.github.com/gr2m/contenteditable-autocomplete/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251227394,"owners_count":21555563,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T04:28:10.055Z","updated_at":"2025-12-12T05:47:56.660Z","avatar_url":"https://github.com/gr2m.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# contenteditable-autocomplete\n\n\u003e Add Autocomplete/Typeahead to contenteditable tag\n\n[![Build Status](https://travis-ci.org/gr2m/contenteditable-autocomplete.svg)](https://travis-ci.org/gr2m/contenteditable-autocomplete)\n[![Dependency Status](https://david-dm.org/gr2m/contenteditable-autocomplete.svg)](https://david-dm.org/gr2m/contenteditable-autocomplete)\n[![devDependency Status](https://david-dm.org/gr2m/contenteditable-autocomplete/dev-status.svg)](https://david-dm.org/gr2m/contenteditable-autocomplete#info=devDependencies)\n\n## Download / Installation\n\nYou can download the latest JS \u0026 CSS code here:\n\n- https://unpkg.com/contenteditable-autocomplete/dist/contenteditable-autocomplete.js\n- https://unpkg.com/contenteditable-autocomplete/dist/contenteditable-autocomplete.css\n\nOr install via [npm](https://www.npmjs.com/)\n\n```\nnpm install --save contenteditable-autocomplete\n```\n\nThe JS code can be required with\n\n```js\nvar jQuery = require('jquery')\nvar contenteditableAutocomplete = require('contenteditable-autocomplete')\n\n// init\ncontenteditableAutocomplete(jQuery)\n```\n\nThe CSS code lives at `node_modules/contenteditable-autocomplete/contenteditable-autocomplete.css`\n\n## Usage\n\n```html\n\u003c!-- load jquery --\u003e\n\u003cscript src=\"jquery.js\"\u003e\u003c/script\u003e\n\n\n\u003c!-- load contenteditable-autocomplete assets --\u003e\n\u003clink rel=\"stylesheet\" type=\"text/css\" href=\"contenteditable-autocomplete.css\"\u003e\n\u003cscript src=\"contenteditable-autocomplete.js\"\u003e\u003c/script\u003e\n\n\u003c!-- The behaviour is initialzied on first interaction --\u003e\n\u003cp\u003e\n  \u003cstrong\u003eCountry:\u003c/strong\u003e\n  \u003cspan contenteditable name=\"country\" placeholder=\"set country\" data-autocomplete-spy\u003e\u003c/span\u003e |\n\u003c/p\u003e\n\n\u003cp\u003e\n  \u003cstrong\u003eCountries:\u003c/strong\u003e\n\u003c/p\u003e\n\u003cp contenteditable name=\"countries\" placeholder=\"set countries\" data-autocomplete-spy data-autocomplete-multiple\u003e\u003c/p\u003e\n```\n\n### Suggestions\n\nTo pass suggestions for the autocomplete, listen to the `autocomplete:request` event\n\n```js\n$('[name=country]').on('autocomplete:request', function(event, query, callback) {\n  var suggestions = getSuggestionsArrayFor(query);\n  callback(suggestions);\n})\n```\n\nInstead of strings, you can also pass objects with the mandatory properties `label` and `value`.\n`label` will be shown as suggestions. When selected, `value` will be added to the input.\n\n$('[name=country]').on('autocomplete:request', function(event, query, callback) {\n  callback([\n    {label: 'Germany (Europe)', value: 'Germany'},\n    {label: 'Thailand (Asia)', value: 'Thailand'},\n    {label: 'Uruguay (South America)', value: 'Uruguay'}\n  ]);\n})\n\n\n### Select event\n\nTo react on when a suggestion has been selected, listen to the `autocomplete:select` event.\n\n```js\n$('[name=country]').on('autocomplete:select', function(event, selected) {\n  console.log('selected item:', selected);\n})\n```\n\nSelected is always an object with `label` and `value` properties (see above). Additional\nproperties passed to suggestions will be passed.\n\n\n## Local Setup\n\n```bash\ngit clone git@github.com:gr2m/contenteditable-autocomplete.git\ncd contenteditable-autocomplete\nnpm install\n```\n\n## Test\n\nYou can start a local dev server with\n\n```bash\nnpm start\n```\n\nRun tests with\n\n```bash\nnpm test\n```\n\nWhile working on the tests, you can start Selenium / Chrome driver\nonce, and then tests re-run on each save\n\n```bash\nnpm run test:mocha:watch\n```\n\n## Fine Print\n\nThe Expandable Input Plugin have been authored by [Gregor Martynus](https://github.com/gr2m),\nproud member of the [Hoodie Community](http://hood.ie/).\n\nLicense: MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgr2m%2Fcontenteditable-autocomplete","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgr2m%2Fcontenteditable-autocomplete","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgr2m%2Fcontenteditable-autocomplete/lists"}