JSFiddle - React, Tailwind, and code Playground
by James Vicary
HTML
<input type="text" class="change" required>
<input tpe
<div class="modal hide">
<p>Warning you have made a change or are about to navigate away</p>
<button class="close">
Close
</button>
</div>
CSS
.hide{
display: none;
}
.modal{
position: fixed;
width: 50%;
height: 100px;
top: 0;
bottom: 0;
right: 0;
left: 0;
margin: 0 auto;
background-color: red;
color: white;
text-align: center;
}
JavaScript
$(".change").on("change", function(){
$(".modal").removeClass("hide");
});
$(".close").on("click", function(){
$(".modal").addClass("hide");
});