get CSS rule's percentage value in jQuery -


let's rule follows:

.largefield {     width: 65%; } 

is there way '65%' somehow, , not pixel value?

thanks.

edit: unfortunately using dom methods unreliable in case, have stylesheet imports other stylesheets, , result cssrules parameter ends either null or undefined value.

this approach, however, work in straightforward cases (one stylesheet, multiple separate stylesheet declarations inside head tag of document).

there's no built-in way, i'm afraid. can this:

var width = ( 100 * parsefloat($('.largefield').css('width')) / parsefloat($('.largefield').parent().css('width')) ) + '%'; 

Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -