JSFiddle - React, Tailwind, and code Playground

by Murali Kaliappan

HTML

<div id="myDiv">
  This is initial Div
</div>


<input type="button" id="firstBtn" value="change to paragraph"/>
<input type="button" id="secondBtn" value="Change to image"/>

CSS

div{
  height:100px;
 
 width:100px;
 overflow:hidden;
 margin-bottom:25px;
}

JavaScript

$("input").click(function(){
	
	$("#myDiv").empty();	
	if( $(this).attr("id") == "firstBtn" ){
  	$("#myDiv").append("<p> This is paragraph</p>")
  } else{
  	$("#myDiv").append("<img src='https://cdn.shopify.com/s/files/1/1640/7469/products/50c6e6dc1386acfa6b28e5ee7355f487_1024x1024.jpg?v=1493400560' height=100 width=100/>")
  }
})