jQuery Test if Element has a Style Value

Looking to test whether an element has a parameter set to a particular value?

If you are configuring elements using jQuery you may also wish to see whether you have already set a value. Perhaps using this to determine actions to be taken.

I was adding a class to an element to signal that I had performed an action. I would then be able to check the element later to judge whether to perform one action or another.

Style values are represented as a pair, the CSS property and one of the associated options.

Consider a header div, with its flex direction set.

<div class="header-branding" style="flex-direction:row;">

With this style parameter assigned its known that another piece of our website code has run, and as part of its actions set this parameter.

Required is a test which will let us know whether the property has been set to a particular value

For example, to test if the flex-direction has been set to column

if(jQuery('.header-branding').css('flex-direction')=='column'){
  //action if true
}

As can be seen a simple test to check whether a style value has been assigned to a website element and given a particular value.