How can i get the 'color' property from test class but should not use .addClass and .css function.
.test {
color: red;
margin: 10px 10px 10px 10px;
}
I need to add color property for other class.something like following
<div class="getproperty"></div>
How can i get only color property from test class to use getproperty class.
I want to get the color property that is for the class:test
and to use the obtained color to another class named as getproperty
.
How can i do this in jquery ?
With jQuery you could do something like this:
var color = $("<i>", {class: "test"}).css("color");
$(".getproperty").css("color", color);
This doesn't require you have an element with the class test in the page
If you want to get the color from the class:
var color = $(".test").css("color");
$(".getproperty").css("color", color);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With