JSFiddle - React, Tailwind, and code Playground

HTML

<div class='row'>
    <input type='text' />
    <input type='text' />
    <div class='link'>the link</div>
</div>

CSS

.linksdiv {
    background: yellow;
}

.link {
    color: blue;
}

JavaScript

var lastInput;
var timeout;

$('input').focus(function() {
    var $th = $(this);
    lastInput = $th;
    clearTimeout(timeout);
    $th.parents('.row').addClass("linksdiv");
}).blur(function() {
    var $th = $(this);
    timeout = setTimeout(function() {
        lastInput = null;
        $th.parents('.row').removeClass("linksdiv");
    }, 150);
});

$('.link').click(function() {
    lastInput.focus();
    // run your code for the link
});