-1

Is there anyway in Javascript I can set every element to have the CSS property overflow: hidden?

I want to do exactly this:

* {overflow: hidden}

But with Javascript, and not JQuery.

I also want this to work if a new element is created on the page, like it would if I used CSS as in the example above.

1 Answers1

2

I found the answer:

var style = document.createElement("style");
style.type = "text/css";
style.innerHTML = "* { overflow: hidden; }";
document.head.appendChild(style);

The most efficient I can think of.