{"id":26502883,"url":"https://github.com/grassator/jquery-declarative-init","last_synced_at":"2026-05-17T13:03:17.483Z","repository":{"id":5240196,"uuid":"6417446","full_name":"grassator/jquery-declarative-init","owner":"grassator","description":"Provides a way to initialize jquery plugins from the elements they are linked to.","archived":false,"fork":false,"pushed_at":"2013-08-29T15:02:24.000Z","size":108,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-04-09T14:49:36.075Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://kubyshkin.ru/posts/declarative-initialization-of-jquery-plugins.html","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"agens-no/AGGeometryKit","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grassator.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-10-27T13:54:26.000Z","updated_at":"2013-10-07T01:08:00.000Z","dependencies_parsed_at":"2022-09-19T04:31:04.767Z","dependency_job_id":null,"html_url":"https://github.com/grassator/jquery-declarative-init","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grassator%2Fjquery-declarative-init","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grassator%2Fjquery-declarative-init/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grassator%2Fjquery-declarative-init/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grassator%2Fjquery-declarative-init/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grassator","download_url":"https://codeload.github.com/grassator/jquery-declarative-init/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244672248,"owners_count":20491336,"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":"2025-03-20T18:36:10.065Z","updated_at":"2026-05-17T13:03:17.385Z","avatar_url":"https://github.com/grassator.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jQuery Declarative Init Plugin\n\nProvides a way to initialize jquery plugins from the elements they are linked to.\nIt works with both jQuery and Zepto.\n\n## Basic Usage\n\nFirst of all we need some plain old jQuery plugin. I will use [lightweight-datepicker](http://maximzhukov.com/demos/lw-datepicker/) for this example since it's really nice and has configuration options which is what we need. Let's say we have a field like this that needs a date picker:\n\n    \u003cinput type=\"text\" id=\"date1\"\u003e\n    \nNow we need a way to specify that this fields needs some query plugins applied to it, so we add a class:\n\n    \u003cinput type=\"text\" id=\"date1\" class=\"jquery-declarative-init\"\u003e\n\nNext thing we need is a way to specify which plugins we need so we add configuration as an `onclick` attribute:\n\n    \u003cinput type=\"text\" id=\"date1\" class=\"jquery-declarative-init\" onclick=\"return {\n        lwDatepicker: { autoFillToday: true }\n    }\"\u003e\n    \nIn options we use a hash where key is plugin name and value is a hash of options for the plugin. All that's left is to run this jquery plugin:\n\n    $('.jquery-declarative-init').declarativeInit();\n\n## Configuration\n\n- `pluginDefaults` - (default: `{}`) - A hash of default options for plugins that will be merged with the ones provided in DOM element.\n\n- `pluginGetter` - (default is function to get plugins from `onclick`) - this is an advanced option that let's you change a way plugins are specified. You can for example use html5 `data-*` attributes.\n\n## Demo\n\nLive demo available [here](http://kubyshkin.ru/samples/jquery-declarative-init.html).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrassator%2Fjquery-declarative-init","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrassator%2Fjquery-declarative-init","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrassator%2Fjquery-declarative-init/lists"}