JSFiddle - React, Tailwind, and code Playground
HTML
<button id="submit">Submit</button>
CSS
input {
display: block;
}
JavaScript
// Creating 20 text inputs with random values
for (var i = 0; i < 20; i++) {
$('<input />').attr({
type: 'text',
value: Math.round(Math.random() * 10)
}).prependTo('body');
}
// Actual code
var inputs = $('input[type="text"]').each(function() {
$(this).data('original', this.value);
});
$('#submit').click(function(){
inputs.css('background-color', function() {
if ($(this).data('original') !== this.value) {
return 'orange';
} else {
return false;
}
});
return false;
});