viery365 viery365 - 11 months ago 52
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?

Answer Source

The answer is Yes you can.

Here is the syntax.

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

Know more on jQuery selectors here,