Dear jQuery Forum,
I'm trying to perform a click function inside a dynamically loaded div. I've looked and implemented many of the tactics I've run into and none of them are working
The code that I'm running to load the div:
$ ( window ). load ( function (){ function showitusers () {
$ ( "#creatorsettingsdiv" ). load ( 'http://XX.XX.XX.XX/quizzes/js/creatorusersdiv.php' ); } $ ( "#creatorsettingsusersbutton" ). click ( function () { var usersvar = showitusers (); }); });
This loads creatorusersdiv.php with an h2 element class userstabletitle. I'm then attempting to display a message when .userstabletitle is clicked with the following:
$ ( window ). load ( function (){ function showitusers () { swal ({ title : "Are you sure?" , text : "You will not be able to recover this imaginary file!" , type : "warning" , showCancelButton : true , confirmButtonColor : "#DD6B55" , confirmButtonText : "Yes, delete it!" , closeOnConfirm : false }, function (){ swal ( "Deleted!" , "Your imaginary file has been deleted." , "success" ); }); } $ ( 'body' ). on ( 'click' , 'h2.userstabletitle' , function () { var usersvar = showitusers (); }); });
Any help would be great, I'm having a tough time with this one.