https://github.com/bredele/attrs
Object as DOM attributes
https://github.com/bredele/attrs
Last synced: over 1 year ago
JSON representation
Object as DOM attributes
- Host: GitHub
- URL: https://github.com/bredele/attrs
- Owner: bredele
- License: mit
- Created: 2016-05-03T03:28:15.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-05-03T23:11:55.000Z (about 10 years ago)
- Last Synced: 2025-03-16T19:37:55.973Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# attrs
Object as DOM attributes.
## usage
```js
var attrs = require('attrs');
var bool = true;
var input = document.createElement('input');
attrs(input, {
id: 'input',
checked: true,
class: ['hello', 'world'],
style : {
top: 100 + 'px',
bottom: 200 + 'px'
},
type: function() {
return bool ? 'radio' : 'checkbox';
}
})
```