javascript - Reload div and set events in jQuery -


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

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -