I would like to when I change #town and #animal value, then inputs background will be red.
My code is change the inputs background, when I change one input, but I would like to, if I change both input, after the code will be change the background color.
My code:
<!DOCTYPE html>
<html>
<head>
<title>Test page</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('#town, #animal').on('change', function() {
$('input').css('background', 'red');
});
});
</script>
</head>
<body>
<input type="text" id="town">
<input type="text" id="animal">
</body>
</html>