Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

jquery.inlineCss

Read/Write/Remove ONLY THE INLINE STYLES of a jQuery Element

You can write values with !important now, which jquery does not support natively.

demo: http://jsbin.com/veyagikazavi/8/edit

Usage

Just like the usual $el.css() but only applies on inline styles.

To read:

This will return the exact value though, so for example if it has !important in it, that would be included,

$el.inlineCss('z-index'); 

To write:

// single property
$el.inlineCss('z-index', '20 !important');

// or using a hash
$el.inlineCss({
    'z-index': '20 !important',
    'background-color': 'red !important'
});

To remove:

Notice the empty string

// single property
$el.inlineCss('z-index', '');

// or using a hash
$el.inlineCss({
    'z-index': '',
    'background-color': ''
});

Chain:

Just like the usual css(), when writing or removing, you can chain other jQuery functions.

$el.inlineCss('display', 'none !important').parent().width();

Browser support

Down to IE8, as long as you're using jquery 1.x

About

control your inline style properties

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages