title: How to trigger the class and append the content in jquery?
body: <p>I need to trigger the class &quot;alert success&quot; when the button is clicked in HTML,</p>
  <p>The code is:</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 appendText() {
    var title = $("#title").val();
    var content = $("#content").val();
    var type = $("#type").val();
    var markup = "&lt;div&gt;" + title + content + "&lt;/div&gt;";
    $(".alert success").append(markup);
    $(".closebtn").append()
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;p style="margin-top: 2%"&gt;
    &lt;select id="type"&gt;
      &lt;option value="success"&gt;success&lt;/option&gt;
      &lt;option value="info"&gt;info&lt;/option&gt;
      &lt;option value="warning"&gt;warning&lt;/option&gt;
      &lt;option value="error"&gt;error&lt;/option&gt;
    &lt;/select&gt;
    &lt;label for="title"&gt;title:&lt;/label&gt;
    &lt;input type="text" value="title" id="title"&gt;
    &lt;label for="content"&gt;content:&lt;/label&gt;
    &lt;input type="text" id="content" value="content" style="width: 50%"&gt;
    &lt;button onclick="appendText()"&gt;Add Notification&lt;/button&gt;
  &lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>I need to create dynamically the following HTML code when the button is clicked.</p>
  <pre><code>&lt;div class=&quot;alert success&quot;&gt;
    &lt;span class=&quot;closebtn&quot;&gt;&amp;times;&lt;/span&gt;  
    &lt;strong&gt;Success!&lt;/strong&gt; Indicates a successful or positive action.
  &lt;/div&gt;
  </code></pre>
  <p>Can you suggest the correct Jquery code for my need?</p>