Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elboletaire/data-attribute-parser
jQuery helper plugin to parse `data-` attributes and load other plugins using that parsed attributes as plugin params.
https://github.com/elboletaire/data-attribute-parser
html-data javascript jquery jquery-plugin parse-attributes plugin
Last synced: 17 days ago
JSON representation
jQuery helper plugin to parse `data-` attributes and load other plugins using that parsed attributes as plugin params.
- Host: GitHub
- URL: https://github.com/elboletaire/data-attribute-parser
- Owner: elboletaire
- License: apache-2.0
- Created: 2014-09-28T15:50:10.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-01-22T15:09:24.000Z (almost 7 years ago)
- Last Synced: 2024-04-25T21:06:30.272Z (7 months ago)
- Topics: html-data, javascript, jquery, jquery-plugin, parse-attributes, plugin
- Language: JavaScript
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
data-attribute-parser
=====================jQuery helper plugin to parse `data-` attributes and load other plugins using that parsed attributes as plugin params.
How to use it?
--------------Here's an example on how to load ckeditor (it's an example!) on textarea
inputs. Assuming you have some textareas like the following:```html
This textarea won't have CKEditor enabled
This textarea will have CKEditor enabled with the specified values
```
Now parse the params and load the plugin:```javascript
$('textarea').parseDataAttributes({
prefix: "ckeditor", // will search for data-ckeditor- prefixed attributes
params: {
// default params to be merged with data- params
toolbar: "full",
resize_enabled: false
}
}, function($this, params) {
// Run a callback after params have been parsed
$this.ckeditor(params);
}
);
```
> WARNING: camelCasedValues are lowercased by the DOM, so you will need to
declare that attributes as dashed-attributes and they will be converted to
camel cased (i.e. `dashed-attributes` to `dashedAttributes`).