viery365 viery365 - 2 months ago 5x
Javascript Question

Modify CSS Flexbox Property value via javaScript or jQuery

I am building a website using flexbox for the first time. I came across a situation where I want to change a css property via javaScript or jQuery but I don't know how.


#elementId {
align-items: center;

I want to change to:

align-items: flex-start;

Is it possible via javaScript or jQuery?


The answer is Yes you can.

Here is the syntax.

$(Selector).css("style-attribute", "value");

Know more on jQuery selectors here,