Lehnhard
Lehnhard

Reputation: 33

How can I make a callbackfunction of add or make this script synchronously?

I wrote a script which load data compile it with handelbars to a string. Then I add these elements to the DOM and want to give them some eventlisteners and functions like draggable but it doesn’t work. It seems that it work asynchronously and not synchronously like I read here in many other posts. Can someone give me a hint where i think wrong?? I posted the code here

http://jsfiddle.net/Zjx35/

I would be really glad for any hint.

Upvotes: 1

Views: 46

Answers (1)

travis
travis

Reputation: 8605

You look to have mis-typed your class name.

//
<div style="position:absolute; top:{{posy}}; left:{{posX}}" class="d_entity">
//
$(".p_entity").draggable().css("background","red");

Updated Example: http://jsfiddle.net/Zjx35/1/

Upvotes: 1

Related Questions