Im trying to convert normal css markup into an object:
.btn {
border-radius: 28px;
padding: 10px 20px 10px 20px;
border:1px solid #000;
}
so it becomes
var btn = {
"border-radius": "28px",
"padding": "10px 20px 10px 20px",
"border":"1px solid #000",
};
then I can use it with jquery css function to style other elements
$(".el").css(btn);
I have tried using both JSON.parse(), and JSON.stringify(), but no success.
normal css markup? Your first variable not an normal css, It's an invalid string.