JSFiddle - React, Tailwind, and code Playground
by OhaiBBQ
HTML
<div style="width: 10px; height: 12px; background-color: #000; "> hi </div>
JavaScript
$(function() {
var _css = $.fn.css;
$.fn.css = function(name, value) {
if (typeof name === "object" && typeof name[0] === "string") {
var ret = {},
key;
for (key in name) {
ret[name[key]] = _css.apply(this, [name[key]]);
}
return ret;
} else {
return _css.apply(this, arguments);
}
};
var $body = $("body");
var $div = $("div");
// Setter
$div.css({
"height": "200px"
});
// Getter
var props = $div.css(["height", "width", "background-color"]);
$.each(props, function(index, element) {
$body.append(index + " = " + element + "<br />");
});
});