0

Is it possible to override the Css Classes with JavaScript ? for exemple :

Adding a background to .iframe style classe.

2
  • indeed it is, thanks Commented Sep 30, 2015 at 2:18
  • Do you mean changing the background for all elements that have the iframe class? Just toggle another class name for those elements and define a CSS rule with the background for only that toggled class. Commented Sep 30, 2015 at 2:18

1 Answer 1

-1

Who is the troll

who down voted my answer? Please provide your reason


Changing a STYLE property

var iframe = document.querySelector('.iframe');
iframe.style['marginBottom'] = "200px";

Changing a CLASS property

iframe['className'] = "myClass";
Sign up to request clarification or add additional context in comments.

1 Comment

Didn't down vote but see e duplicate question what this was really about.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.