I want to add text to an existing div, when I click the Button with the id #add. But this is not working.
Here my code:
$(function () {
$('#Add').click(function () {
$('<p>Text</p>').appendTo('#Content');
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id="Content">
<button id="Add">Add</button>
</div>
See Question&Answers more detail:os