0

Is there any way to make all the elements that are in the absolute position become hide?

 $("#element").hide();
Ionică Bizău
  • 109,027
  • 88
  • 289
  • 474
user3517672
  • 131
  • 4

2 Answers2

6

You need to iterate all items and to verify if the element has absolute position:

$("*").each(function () {
    if ($(this).css("position") === "absolute") {
        $(this).hide();
    }
});

JSFIDDLE

Ionică Bizău
  • 109,027
  • 88
  • 289
  • 474
3

I think, you can use the attribute selector with contains clause *

$('[style*="position: absolute"]').hide()

Edit

This will hide only if the element has inline style for position.

Or you can use the code below to hide all the elements using filter()

$('*').filter(function() {
    return $(this).css('position') == 'absolute';
}).hide();
Anoop Joshi P
  • 25,373
  • 8
  • 32
  • 53