I have a master container php file with a div container. Initially, the div container doesn't have any content or html children by default when page is loaded. I use JQuery to load php files to this div container when the user clicks a navigation item in the navbar.
landingpage.php
<?php
require_once 'navbar.php';
?>
<!DOCTYPE html>
<html>
<head>
    <title>Admin | Dashboard</title>
    <link rel="stylesheet" href="css/dashboard_admin.css">
</head>
<body>
<div class="wrapper">
    <!-- CONTENT CONTAINER's content depends on what was clicked on navbar -->
    <div class="container" id="content_container">
        <div class="div_dashboardLabel" id="dashboard_Label">
            <h2 id="label_Dashboard">Admin Dashboard</h2>
        </div>
    </div>
    <!-- END OF CONTENT CONTAINER-->
</div>
<!-- end of wrapper-->
<script src="js/jquery-3.3.1.js"></script>
<script type="text/javascript">
    var user = '<?php echo json_encode($user);?>';
    var role = '<?php echo json_encode($role); ?>';
</script>
<script src="js/landingpage.js"></script>
</body>
</html>
landingpage.js
/* GLOBAL VARIABLES WITHIN THIS DOCUMENT*/
var div_content_container = $("#content_container");
var navitem_dashboard = $("#admin_dashboard");
var navitem_admin_account_management = $("#admin_accountmanagement");
var userObj = JSON.parse(user);
var roleObj = JSON.parse(role);
var logout = $('#logout');
/* END */
$(document).ready(function(){
    loadDashboard(); // dashboard is loaded as default view.
    navitem_admin_account_management.on("click",loadAccountManagement);
});
function loadDashboard() {
    var url_admin_dashboard = 'view/admin_dashboard.php';
    var url_teacher_dashboard = 'view/teacher_dashboard.php';
    var url_student_dashboard = 'view/student_dashboard.php';
    div_content_container.html('');
    if (roleObj.rolename === 'Administrator') {
        div_content_container.load(url_admin_dashboard);
    } else if (roleObj.rolename === 'Teacher') {
        div_content_container.load(url_teacher_dashboard);
    } else if (roleObj.rolename === 'Student') {
        div_content_container.load(url_student_dashboard);
    }
}
function loadAccountManagement(){
    var url = 'view/admin_accountmanagement.php';
    div_content_container.html('');
    div_content_container.load(url);
}
Everything works as expected for landingpage.php which uses landingpage.js for the front end. No problem.
The problem is when admin_accountmanagement.php file is loaded in div_content_container. The JS of admin_account_management.php doesn't seem to bind to elements:
function loadAccountManagement(){
    var url = 'view/admin_accountmanagement.php'; // has its JS file
    div_content_container.html('');
    div_content_container.load(url);
}
For example, let's take url which is 'view/admin_accountmanagement.php' This page gets loaded within div_content_container when user clicks a navbar item Account Management
as in
<div class="wrapper">
    <!-- CONTENT CONTAINER's content depends on what was clicked on navbar -->
    <div class="container" id="content_container">
        <!-- view/admin_accountmanagement.php loaded here --> 
    </div>
    <!-- END OF CONTENT CONTAINER-->
</div>
There are no problems displaying the page or replacing the current element contained in the div_content_container. The problem is, the JS file attached to view/admin_accountmanagement.php doesn't seem to apply when view/admin_accountmanagement.php page is loaded in div_content_container
The view/admin_accountmanagement.php is loaded but the click events binded to the elements of view/admin_accountmanagement.php doesn't work. I know this because I tried to display an alert() message on $(document).ready()
admin_accountmanagement.php
<body>
    <div>
    <button class="button" id="btn_AddUser">
        Add New User
    </button>
    </div>
    <script src="js/admin_accountmanagement.js"></script> <!-- this JS doesn't seem to get binded when this page is loaded in the div_content_container -->
</body>
admin_accountmanagement.js
var btn_add_user = $('#btn_AddUser');
$(document).ready(function(){
    alert("TEST"); //doesn't work no alert message.
    btn_add_user.on("click",test); //doesn't work no alert message
});
function test(){
    alert("testing"); //doesn't work. no alert message
}
I'm only able to display the page but when I click on the <button id="btn_AddUser"> nothing happens. 
How can I solve this given the how I structured the loading of pages to div_content_container? 
Thanks in advance.
window.load()instead ofdocument.ready().$(document).ready()of admin_accountmanagement.js with$(window).load(function(){ alert("TEST); })but didn't work.btn_add_user.on("click",test);, it will only bind that event if the element exists on page load (which it doesn't, since you're using ajax to load it after). You need to bind it something like:$('body').on('click', 'the-button-identifier', test);. That will bind the event to the body and then, it will add it on all elements that matches the "the-button-identifier" as they appear in the DOM.