JSFiddle - React, Tailwind, and code Playground
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) {
var styles = this.attr("style"),
value;
styles && styles.split(";").forEach(function (e) {
var style = e.split(":");
if ($.trim(style[0]) === prop) {
value = style[1];
}
});
return value;
};
}(jQuery));
console.log($("div").inlineStyle("background-color"));