JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<h1>Jquery div example</h1>
<button><i>click to create div</i></button>

JavaScript

$(document).ready(function(){
var chat_box_title = 'jaya chandra';
$("button").click(function(){
  $('<div/>')
  .attr({id:'chat_box_'+chat_box_title})
  .addClass('chat_box')
  .html('<div class="chat_head">jaya chandra<span class="chat_close"><a     class="chat_close" href="javascript:void(0)" onclick="javascript:closeChatBox(\''+chat_box_title+'\')">X</a></span></div><div class="chat_wrapper"><div class="chat_body"></div><div class="chat_footer"><textarea rows="4" placeholder="Your message here..." class="chat_input"></textarea></div></div>')
    .appendTo('body');

 });
 
 $('body').on('click','div.chat_head',function(){
$('.chat_wrapper').slideToggle('slow');
console.log('clicked');
});
 });