For dynamically elements, we should use $.on as suggested by others. But in your case, it should work without using $.on. The reason it does not work it your case because of <a> tag default action to reload, try event.preventDefault();
$(function(){
$("#nav_container").append('<a id="testID" href="#">Click on me</a>');
$("#testID").bind("click",function(event){
event.preventDefault();
alert("hi");
});
});
Or better as suggested by others to use $.on:
$("#nav_container").on('click', '#testID', function(event){
event.preventDefault();
alert('hi');
});