I am trying to obtain the list of CSS properties of an element that are overridden, example:
.div{
position:absolute;
top:10px;
}
When we use this code:
jQuery('.div').css('bottom');
I obtain:
bottom:-10px;
If I use get computed or jquery.css I will get the same result, but in fact I want to obtain:
empty or null
because I didn't specify / overridden.
Values expected in this example: top: 10px bottom: auto or null or nothing
https://codepen.io/anon/pen/dvvdVv
Again, I only wanted the properties that were overridden.
===================== EDIT ======================
My objective is only to get the value top,bottom from the following element:
<div id='box' class='giveItSomeTop' style="top:10px"></div>
and the css for the element, notice that I have only specified top:
.giveItSomeTop{
top:10px;
}
Now I want to get the top value and the bottom value. If I do:
$('#box').css('top');
The result is: 10px
but when I do:
$('#box').css('bottom');
I get 700px when I should get empty, nothing, null or ''
.css(x)it is not trying to parse the css file... THAT is what you're looking for. If you take a look at the documenation, it saysGet the value of a computed style property: api.jquery.com/css you will need to write a CSS file parser.