Jquery onclick remove parent div
<p>I have the following code but how can i achieve when clicking on the remove button the parent div removes?</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>     function removeDiv(){
            $(this).parent('div').remove();
        }</code></pre>
<pre class="snippet-code-css lang-css prettyprint-override"><code>   </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;div&gt;
        &lt;div&gt;
            &lt;div&gt;&lt;button onClick="removeDiv()"&gt;button1&lt;/button&gt;&lt;/div&gt;
        &lt;/div&gt;
        &lt;div&gt;
            &lt;div&gt;&lt;button onClick="removeDiv()"&gt;button2&lt;/button&gt;&lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;</code></pre>
</div>
</div>
</p>