I'm trying to show a form on clicking #createbook followed by submitting the form via AJAX. For test purpose, I am trying to alert hello world on clicking #addme but its not working.But when I entered the on click function on the browser and it works. Can you guys help me figure this out. Thank you. :)
<div id="mode" style="display:none">
</div>
<script>
$("#createbook").click(function () {
$.get("BooksLibrary/Create #create", function (data) {
$("#mode").html(data + '<button class="btn btn-primary" id="addme">Add Book</button>');
});
$("#mode").dialog({
modal: true,
title:'Add Book'
});
$("#mode").css({ "display": "block" });
});
$("#addme").click(function () {
alert("hello world");
});
</script>