JSFiddle - React, Tailwind, and code Playground
HTML
<p>
click edit then change text box value. cancel buton will replace with your old data
</p>
<form id="evaluationForm">
<input type="text" value="1"/><br>
<input type="text" value="2"/><br>
<input type="text" value="3"/><br>
<button type="button" id="evaluationFormEdit">
Edit
</button>
<button type="button" value="Cancel" id="evaluationFormEditCancel">
Cancel
</button>
</form>
JavaScript
$(document).ready(function() {
$('#evaluationFormEdit').click(function() {
$('#evaluationForm').find(':input').each(function(i, elem) {
$(this).data("previous-value", $(this).val());
});
});
function restore() {
$('#evaluationForm').find(':input').each(function(i, elem) {
$(this).val($(this).data("previous-value"));
});
}
$('#evaluationFormEditCancel').click(function() {
restore();
});
});