hello brian,
I was really busy with my regular job yesterday and I couldnt find any
chance to take a look my project. but today finally I built github/xui
version without any error. it works really great now. but something
strange happened in my tests.
let's say I create many div(absolute) elements and add them into body
as innerHTML.
When I create a div I apply some modifications before adding another
one.
* Top, Left, Width, Height
After these style modifications I apply this event binding:
$('my-div').on('click', function(e){alert(
e.target.id);});
After this event binding my loop jumps to next and creates another
div. etc.
I add 100 elements in that routine. But click event works for last one
only!
Is there any callback feature for x$().html method? I think I try to
apply event binding before I create the element.
Source code of my routine:
parent = x$(document.getElementsByTagName('body'));
parent.html('inner', parent.html() + '<div id="' + id + '"></div>');
x$('#' + id).addClass(cls)
.css({
position: 'absolute',
top: top,
left: left,
'border-radius': round,
width: width,
height: height
});
x$('#' + id).on('click', handler);
By the way, if I bind event to my elements after all of them created
there is no problem. click event works for each of them. what do you
think?
-Umut
> Cell:
+1 (604) 868-1978http://blogs.nitobi.com/brianhttp://www.nitobi.comhttp://twitter.com/brianleroux