apply css property directly by javascript and a good practice? [closed]

0

I am creating a website and for me to be able to keep a bigger control and save time having to be changing the tab all the time I am applying the properties direct by javascript, I would like to know this influences something insira o código aqui     $ ("# test"). css ("border-style", "solid") css ("background-color", "transparent")     .css ("height", "100%");

$("h1").css("display", "inline-block");

$("#teste1").css("background-color","blue")
.css("height","50px");

$("#teste2").css("background-color","green")
.css("height","50px");

$(".navbar-header").css("background-color","transparent")
    
asked by anonymous 27.12.2016 / 03:32

1 answer

1

Applying properties such as background-color is not a good practice, it is bad to track and understand the styles you are using, now if you apply classes, that works out better.

This is even easier on javascript using classList.add ( w3schools.com ), or even with jQuery using addClass , removeClass or toggleClass ( api.jquery.com/toggleclass ).

    
27.12.2016 / 13:00