JSFiddle - React, Tailwind, and code Playground

by Nick Hulea

HTML

<input type="text" name="a" value="something">

JavaScript

$(document).on('input', ':input', function() {
    alert('new:' + $(this).val() + ' old:' + $(this).data('oldValue'));
    $(this).data('oldValue', $(this).val());
});

$(':input').each(function() {
    $(this).data('oldValue', $(this).val());
});