If #input2 is connected to a dataset that is tied to Database2, you need a dataset onReady statement too.
$w.onReady(function () {
$w("#dataset2").onReady( () => {
let value1 = $w("#input1").value;
let value2 = $w("#input2").value;
if ( value1 === value2) {
$w("#updatebutton").show(); //do this thing
} else {
$w("#updatebutton").hide(); //or else do this
}
});
});