How to get value from a dynamic element
<p>I need to get the value from a "p" element, I draw this "p" with jQuery and it's ok, then I have a button and when I click on it I want to display the value from "p" element but I don't get any information, here is a simple code example:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() {
  $('#c').click(function() {
    var p = $('#p1').val();
    alert(p);
  });

  draw();
});


function draw() {
  var html = "";
  html += '&lt;p id="p1"&gt;Hi&lt;/p&gt;';

  $('#d').html(html);

}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;


&lt;button id="c"&gt;Click&lt;/button&gt;
&lt;hr /&gt;
&lt;div id="d"&gt;
&lt;/div&gt;</code></pre>
</div>
</div>
</p>

<p>How can I solve this? I don't get any console error.</p>