You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-12Lines changed: 5 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# jquery.initialize
2
2
3
-
Version: 1.0.0, Last updated: 12/14/2016
3
+
Version: 1.1.0, Last updated: 2017-02-06
4
4
5
5
jquery.initialize plugin is created to help maintaining dynamically created elementes on page.
6
6
@@ -20,21 +20,13 @@ TODO: make it `bower` and `npm` compatible, add advanced performance test.
20
20
21
21
**Initialize has exactly the same syntax as with the .each function**
22
22
23
-
$(".some-element").initialize( function(){
23
+
$.initialize(".some-element", function(){
24
24
$(this).css("color", "blue");
25
25
});
26
26
27
27
But now if new element matching .some-element selector will appear on page, it will be instantly initialized. The way new item is added is not important, you dont need to care about any callbacks etc.
28
28
29
-
$("<div/>").addClass('some-element').appendTo("body"); //new element will have blue color!
30
-
31
-
32
-
Note that plugin needs to know the selector of items you want to initialize. Thats why you need to **call initialize right after you've created jQuery element from selector.**
33
-
34
-
$(".some-element").initialize(myFunc); //will work
35
-
$(".some-element").children().initialize(myFunc); //will NOT work
36
-
37
-
29
+
$("<div/>").addClass("some-element").appendTo("body"); //new element will have blue color!
38
30
39
31
**Support**
40
32
@@ -48,4 +40,5 @@ Note: To make it work on IE9 and IE10 you'll need to add MutationObserver polyfi
0 commit comments