viery365 viery365 - 3 months ago 10
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.

example:

#elementId {
/*flex-item*/
align-items: center;
}


I want to change to:

align-items: flex-start;


Is it possible via javaScript or jQuery?

Answer

The answer is Yes you can.

Here is the syntax.

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

Know more on jQuery selectors here, http://www.w3schools.com/jquery/jquery_ref_selectors.asp