Is it possible to get value of multiple CSS properties in single statement?
Answer Posted / chaitanya
Well, before jQuery 1.9 release it was not possible but one of the new feature of jQuery 1.9 was .css() multi-property getter.
Hide Copy Code
var propCollection = $("#dvBox").css([ "width", "height", "backgroundColor" ]);
In this case, the propCollection will be an array and it will look something like this.
Hide Copy Code
{
width: "100px",
height: "200px",
backgroundColor: "#FF00FF"
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What are the four parameters used for jQuery Ajax method?
Define .siblings() method in jquery?
Difference between document.ready and window.onload? : jQuery Mobile
How to include jQuery in ASP.Net project?
Explain the difference between find and children methods in jquery?
What is the use of clone method in jQuery?
How can jquery library be added to pages? Write a basic jquery code?
Explain which program is useful for testing jquery?
What is the method used to define the specific character in place of $ sign?
Difference between detach and remove? : jQuery Mobile
How can we show and hide an element via jquery?
Define width() vs css('width')?
Explain the difference between $(this) and 'this' in jquery?
Whether we need to add jQuery file in both Master and Content page?
How do you select an item using css class or id and get the value by use of jquery.