JSFiddle - React, Tailwind, and code Playground

HTML

<div id="word1"><input type="text" class="Q"></input><input type="text" class="A"></input></div><br>
<div id="word2"><input type="text" class="Q"></input><input type="text" class="A"></input></div><br>

JavaScript

$(document).ready(function(){
    $(".Q,.A").blur(function(e){
        if($(this).val().length>0 && $(this).siblings("input").val().length>0){
            $(this).parent().fadeOut(1000);
        }
    });
});