Is it possible to get value of multiple CSS properties in single statement?



Is it possible to get value of multiple CSS properties in single statement?..

Answer / 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

More jQuery Interview Questions

How to debug jQuery?

0 Answers  


How to resolve conflicts with other libraries?

0 Answers  


What is the difference between jquery.size() and jquery.length?

1 Answers  


Difference between prop() and attr()? : jQuery Mobile

0 Answers  


Can you please explain the difference between body onload() and document.ready() function? : jquery mobile

0 Answers  


Please explain remove class jquery with example?

0 Answers  


What is the use of delegate() method in jquery?

0 Answers  


What is serialize() in jquery?

0 Answers  


What is method chaining in jquery?

0 Answers  


What is jquery mobile theming? : jquery mobile

0 Answers  


Which is the latest version of jQuery library?

1 Answers  


Why jQuery is better than JavaScript?

0 Answers  


Categories