JSFiddle - React, Tailwind, and code Playground

HTML

<input class="activeInput" type="text" name="key1" value="red">
<input class="activeInput" type="text" name="key3" value="France">

JavaScript

$(function() {
    var map = {};
    $(".activeInput").each(function() {
        map[$(this).attr("name")] = $(this).val();
    });
    
    alert(map.key1); // "red"
});