Return Inline Style
HTML
<div style="width: 100px; height: 100px; background-color :red"></div>
<div style="width: 200px; height: 100px; background-color :blue"></div>
JavaScript
(function($) {
$.fn.inlineStyle = function(prop) {
if (typeof prop !== "undefined") {
return this.prop("style")[$.camelCase(prop)];
}
};
}(jQuery));
console.log($("div").inlineStyle("width"));
console.log($("div").inlineStyle("background-color"));
console.log($('div').inlineStyle());