{"id":24383318,"url":"https://github.com/firstandthird/data-attrs","last_synced_at":"2026-04-19T16:36:01.872Z","repository":{"id":19064730,"uuid":"22291474","full_name":"firstandthird/data-attrs","owner":"firstandthird","description":"jQuery Plugin for data attributes","archived":false,"fork":false,"pushed_at":"2016-12-23T17:29:34.000Z","size":30,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-04T09:40:21.936Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/firstandthird.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2014-07-26T16:58:27.000Z","updated_at":"2016-04-11T03:15:46.000Z","dependencies_parsed_at":"2022-09-11T02:10:28.516Z","dependency_job_id":null,"html_url":"https://github.com/firstandthird/data-attrs","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fdata-attrs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fdata-attrs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fdata-attrs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fdata-attrs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/firstandthird","download_url":"https://codeload.github.com/firstandthird/data-attrs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243258504,"owners_count":20262301,"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-01-19T10:14:14.119Z","updated_at":"2025-12-26T17:02:23.908Z","avatar_url":"https://github.com/firstandthird.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Data Attrs\n\nA set of utility plugins to deal with data attributes.  Data attributes are great when you want to separate your javascript completely from IDs and classes.\n\n## Install\n\n`bower install data-attrs --save`\n\n## Utilities\n\n### $.named\n\n`$.named('element')` will search for `\u003cdiv data-name=\"element\"\u003e\u003c/div\u003e`\n\n### $.action\n\n`$.action('delete', handler)` will get called when `\u003ca data-action=\"delete\"\u003eDelete\u003c/a\u003e` is clicked.\n\nIf it will also pass back values, so if you had `\u003ca data-action=\"approve\" data-action-id=\"123\"\u003eApprove\u003c/a\u003e` you could have something like this:\n\n```\n$.action('approve', function(e, values) {\n\t//this is the a tag that was clicked\n\t//e is the click event\n\t//values is an object that looks like { id: '123' }\n});\n```\n\n#### Scoped Actions\n\n`$.action('delete', el, handler)` will get called when `\u003ca data-action=\"delete\"\u003eDelete\u003c/a\u003e` is clicked inside `el`.\n\n### $.module\n\n`$.module('name', function(el, values, els) {});` callback will only get called if the `data-module=\"name\"` exists.\n\nIt will also pass back any values and named elements. For example:\n\n```html\n\u003cdiv id=\"module\" data-module=\"module\" data-module-value=\"123\"\u003e\n  \u003cdiv data-name=\"title\"\u003eTitle\u003c/div\u003e\n  \u003cp\u003eContent\u003c/p\u003e\n\u003c/div\u003e\n```\n\nThe callback will be called with:\n\n`callback(el, { value: '123' }, { title: titleEl });`\n\n### Declaritive Plugins\n\nDeclaritive Plugins will automatically bind elements to jQuery plugins.\n\nWith something like this:\n\n```\n\u003cdiv data-plugin='slider' data-plugin-pages=\"3\"\u003e\u003c/div\u003e\n```\n\nIt will automatically call this behind the scenes:\n\n```\n$(el).slider({ pages: 3 });\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirstandthird%2Fdata-attrs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffirstandthird%2Fdata-attrs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirstandthird%2Fdata-attrs/lists"}