https://github.com/rvflash/jquery-datas
Extends jQuery data function to manage internal datas, HTML5 data-attributes and elements with class 'data-*' or 'datas-' for multiple values by name
https://github.com/rvflash/jquery-datas
Last synced: 8 months ago
JSON representation
Extends jQuery data function to manage internal datas, HTML5 data-attributes and elements with class 'data-*' or 'datas-' for multiple values by name
- Host: GitHub
- URL: https://github.com/rvflash/jquery-datas
- Owner: rvflash
- Created: 2012-06-11T23:02:30.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2012-06-12T22:25:57.000Z (over 13 years ago)
- Last Synced: 2025-01-28T16:16:36.761Z (9 months ago)
- Language: JavaScript
- Size: 102 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
jQuery-Datas
============
Extends jQuery data function to manage internal datas, HTML5 data-attributes and elements with class 'data-*' or 'datas-' for multiple values by name
## Examples ##
For example, you can do:
-
My product 1
- 45.00 €
- 40.00 €
Of course, you can add, remove or modify datas as you would with jquery data:
$("#items li").datas('catid', 565);
And later access the dataset object:
$("#items li:first").datas(); // {id: 123, catid: 565, title: "My product 1", prices: ['45.00 €', '40.00 €']}
Or call a specific data attribut by name:
$("#items li:first").datas("title"); // "My product 1"
Html element with class like "data-..." will be stored as if it was tagged with an HTML5 attribute.
For store multi values with the same key as array, we will use class named "datas-..." and content of each child will be stored separately