Remove DIV using jQuery Based on CSS Value

| June 5, 2019

This is an exercise to see if a DIV could be removed from a page using jQuery by selecting based on a CSS value. It is based on this WordPress support question. What’s happening to the author’s site is that there are a number of rogue DIVs which have a CSS left property set to -9999px, which is creating a huge blank left margin. Was able to hide the DIVs using CSS on desktop, but still showing up on mobile.

There is a “rogue” DIV after this paragraph with the left CSS value set to -99. The jQuery should remove it.

This is a rogue DIV.

The rogue DIV is before this paragraph.

Leave a Reply

Your email address will not be published. Required fields are marked *