JSFiddle - React, Tailwind, and code Playground
by Ivan Mishchenko
HTML
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<div class = "list">
<h1>Empty</h1>
<h1>Empty</h1>
<h1>Empty</h1>
</div>
JavaScript
$('h1').toggle(
function(){
var font = $(this).text();
if(font=="Red"){
$(this).remove();
$(".list").append("<h1>Empty</h1>");
}else{
$(this).text("Green");
$(this).css("background-color", "green");
}
},
function(){
$(this).text("Blue");
$(this).css("background-color", "blue");
},
function(){
$(this).text("Red");
$(this).css("background-color", "red");
}
);