jquery add html in div code example

Example 1: jquery add div element

$('#someParent').append('<div>I am new here</div>');

Example 2: how to add jquery to html

<!--You can insert Jquery into HTML with the <script> tag.-->
<head>
  <script type = 'text/javascript' src = 'https://code.jquery.com/jquery-3.3.1.js'></script>
</head>

Example 3: jquery add div

$('#box').append(
  $('<div/>')
    .attr("id", "newDiv1")
    .addClass("newDiv purple bloated")
    .append("<span/>")
      .text("hello world")
);

Example 4: add html after div jquery

$( ".inner" ).after( "<p>Test</p>" );