Well, firstly, you should NEVER pass a string to setTimeout . In this case, you can just pass showIt (without parentheses!), And it will work fine.
As for your real problem, you can try something like this:
document.querySelector("[id^=gatewayContainerstacks]").style.visibility = "hidden";
However, keep in mind that this will not work in Internet Explorer prior to version 8 and may not work in some older mobile browsers.
For a more general solution, I suggest providing a unique and well-known identifier, and then putting other information in the data-* attributes:
<div id="gatewayContainerstacks" data-in="9" data-page="4">...</div>
Or something like that.
source share