$(document).ready(function() after HTML injection
document-ready, inject, jquery
Solution
You should use .on to attach events to dynamic elements.
$j(document).on("click", ".rij", function() { ... });
Problem
I'm trying to live edit data. To do this I found this script http://www.9lessons.info/2011/03/live-table-edit-with-jquery-and-ajax.html The script works perfectly when the table get's created in the php file but I'm trying to do this by injecting the table through javascript. This is my php page ``` <script type="text/javascript" src="javascript/default/gebruikers.js"></script> <div id="adminGebruikersDiv" class="adminGebruikersDiv"></div> <script type="text/javascript"> onload = function() { loadGebruikers(); }; </script> ``` the function loadGebruikers creates the table and injects it in the div. Now I want this code to work ``` $j(document).ready(function() { $j(".rij").click(function() {}).change(function() {}); $j(".editbox").mouseup(function() {}); $j(document).mouseup(function() {}); }); ``` So how can I do this using jquery EDIT: now kind of works ``` $j(document).on("ready", function() { $j(document).on("click", ".rij", function() {}).on("change", function() {}); $j(document).on("mouseup", ".editbox", function() {}); $j(document).on("mouseup", ".document", function() {}); }); ```