Clear Element

Clear P tag on button click

by Glen Carrie

HTML

<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
 
<p>
  Hello, <span>Person</span> <em>and person</em>.
</p>
 
<button>Call empty() on above paragraph</button>

CSS

p {
    background: yellow;
  }

JavaScript

$(document).ready(function() {
    alert('ready');
		$( "button" ).click(function() {
  $( "p" ).empty();
});

})