JSFiddle - React, Tailwind, and code Playground

HTML

<div id="elementToGetAllCSS"></div>

<input type="text" name="search_location" id="search_location" placeholder="Any Location" autocomplete="off">

CSS

#elementToGetAllCSS {height: 10px; width: 20px;}
#elementToGetAllCSS:before {content:""; height: 100px;}

#elementToGetAllCSS:hover {height: 100px;}

JavaScript

// Get all styles associated with element
var style = css(jQuery("#elementToGetAllCSS"));

function css(a) {
    var sheets = document.styleSheets, o = {};
    for (var i in sheets) {
        var rules = sheets[i].rules || sheets[i].cssRules;
        
        for (var r in rules) {
            console.log(rules[r])
            if (typeof rules[r] == 'object' && 
                'selectorText' in rules[r] && 
                rules[r].selectorText.indexOf('::') == -1 &&
                rules[r].selectorText.indexOf(':hover') == -1
               ) {
                if (a.is(rules[r].selectorText)) {
                    o = $.extend(o, css2json(rules[r].style), css2json(a.attr('style')));
                }
            }
        }
    }
    return o;
}

function css2json(css) {
    var s = {};
    if (!css) return s;
    if (css instanceof CSSStyleDeclaration) {
        for (var i in css) {
            if ((css[i]).toLowerCase) {
                s[(css[i]).toLowerCase()] = (css[css[i]]);
            }
        }
    } else if (typeof css == "string") {
        css = css.split("; ");
        for (var i in css) {
            var l = css[i].split(": ");
            s[l[0].toLowerCase()] = (l[1]);
        }
    }
    return s;
}

// Apply styles to target element
var style = css(jQuery("#elementToGetAllCSS"));
console.log(style)
jQuery("#search_location").css(style);