This question was already answered here: Check if element is visible in DOM, but I am getting an error in the correct solution first option. It says:
Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
    at isHidden (index.js:16)
    at hidde (index.js:12)
    at HTMLDocument.document.onkeypress (index.js:8)
This is my code:
document.onkeypress = function(evt) {
    evt = evt || window.event;
    var charCode = evt.keyCode || evt.which;
    var charStr = String.fromCharCode(charCode);
    var key = charStr;
    hidde(<element>)
};
function hidde(element) {
    return (isHidden(element))
}
function isHidden(el) {
    var style = window.getComputedStyle(el);
    return (style.display === 'none')
}
I changed <element> to the element I needed to check.
Is there anything to correct?
Thanks in advance!!!
 
    