i try load div via jquery , want set click-event on dynamically created element makes request php-script , reloads div. unfortunately events aren't set after reload. code far looks this:
$(document).ready(function () { $("#incomplete").load("incompletetasks.php", '', function () { //setting click-events $(".btn_aufg").click(function () { window.alert($(this).attr("id")); var encoded = encodeuricomponent($(this).attr("id")); //marking task completed... $(this).load("taskworker.php?action=complete&id=" + encoded); //reloading div $("incomplete").load("incompletetasks.php"); }); });
});
how can activate event again after user has clicked on button?
do this...
$(document).("click",".btn_aufg",function () { var encoded = encodeuricomponent($(this).attr("id")); $(this).load("taskworker.php?action=complete&id=" + encoded); //reloading div $("#incomplete").load("incompletetasks.php"); }); $("#incomplete").load("incompletetasks.php");
Comments
Post a Comment