https://github.com/morulus/jquery.tie
Additional functions for HTML build
https://github.com/morulus/jquery.tie
Last synced: about 1 year ago
JSON representation
Additional functions for HTML build
- Host: GitHub
- URL: https://github.com/morulus/jquery.tie
- Owner: morulus
- License: mit
- Created: 2014-10-10T12:21:48.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-10-10T14:40:26.000Z (over 11 years ago)
- Last Synced: 2025-05-15T13:18:34.294Z (about 1 year ago)
- Language: JavaScript
- Size: 141 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
jquery.tie
==========
Additional functions for HTML build
# Usage
```javascript
// Adds a inside div (return this a)
$("div").put($('', {
"class": "newa"
}));
// Adds a after div (return this a)
$("div").and($('', {
"class": "newa"
}));
// Adds a before div (return this a)
$("div").before($('', {
"class": "newa"
}));
// Call anonym function in context of div (return this div)
$("div").tie(function() {
$(this).put($(''));
});
// Eval condition and call first function is true and second function if false (return functions result)
$("div").condition(a==b, function() {
return $(this).put($(''));
}, function() {
$(this).and($('
'));
return this;
});
```
# Benefits
Compact code and ease to creating sub-elements
```javscript
$('body')
.put($(''))
.tie(function() {
$(this).put($('
')).html('Hello, world')
.and($('')).html('It's my article'));
})
.and($(''))
.put($('')).html('Call me');
```
# Install
```bower
$ bower install jquery.tie
```