Reputation: 37
On my site (no example, it's company facing), I am calling someone else's JS code that writes html to the page. Unfortunately they are using visibility:hidden rather than display:none in an element with no class id. I need to know the easiest way to target the elements with visibility:hidden and change them with display:none, preferably without using 3rd party solutions.
Is there any way to use css to target elements with certain styles already set, or to change the default behavior of visibility:hidden to take up no space?
Upvotes: 0
Views: 1444
Reputation: 11148
try this:
$('selector').each(function() {
if ($(this).css("visibility") == "hidden") {
$(this).css('display', 'none');
}});
P.S. just edited my JS, now it works perfectly :)
Upvotes: 2