This is the script that I've written. The first click function works fine but the other two don't work as expected. The tags follow the href link and the function for its click doesn't work. Is it because they have been created by jQuery and are not in the original html page?
$("#edit-description").click(function(){
$("#add-description").replaceWith( "<div id='add-description'><textarea cols='43' rows='9' placeholder='Add a description...'></textarea><a href='#' class='u-update'>Update</a><a href='#' id='add-description-cancel'>Cancel</a></div>" );
return false;
});
$("#add-description-cancel").click(function(){
$("#add-description").replaceWith( '<div id="add-description">Write a <a href="/#" id="edit-description">description</a> about the college.</div>');
return false;
});
$(".u-update").click(function(){
$("#add-description").replaceWith( '<div id="add-description">Write a <a href="/#" id="edit-description">description</a> about the college.</div>');
return false;
});