Instead of
$("p").click(function(){
try below
$('body').on('click', 'p', function() {
When you append the HTML dynamically, events will not be binded to the controls. Hence, you need to bind the events dynamically as above. And try not to mix JavaScript and JQuery. You can write all code in JQuery alone.
You can refer below link
JQuery - On