Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 9a5a0e0

Browse files
committed
[Task] initial commit
1 parent 99c018a commit 9a5a0e0

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
exists
22
======
33

4-
jquery plugin
4+
jQuery Plugin for checking wether an element exists and if it does run some code.
5+
6+
Used to optimize performance of your script by deferring actions intended for optional elements.
7+
8+
Usage
9+
-----
10+
```javascript
11+
$('#element').exists(function() {
12+
do stuff upon existence of #element
13+
});
14+
``

jquery.exists.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
3+
@description do stuff upon existence of any given element
4+
*/
5+
;(function($){
6+
7+
$.fn.exists = function(actions){
8+
this.length && actions.apply(this);
9+
};
10+
11+
return this;
12+
13+
})(jQuery);

0 commit comments

Comments
 (0)