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


Please Help Members By Posting Answers For Below Questions

What are all the ways to include jQuery in a page?

468


Do you know what is the use of jquery.data()?

443


How to search for descendant elements that match the specified selectors using ?

440


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

413


How do you select all elements with the class of “selected” in jquery?

426






What are selectors in jquery? Explain

466


How did you become the creator of jquery ui? Whats the story behind that?

746


Is jQuery is a JavaScript or JSON library file?

524


Can you use any other name in place of $ (dollar sign) in jQuery?

515


Explain jquery $.ajax() method?

453


What is the difference between settimeout() and setinterval() methods?

453


What is the difference between the knockout and jquery?

434


Explain all the ways to include jquery in a page?

447


Which one is more efficient, document.getElementbyId( "myId") or $("#myId)?

498


How can we include jQuery library in ASP.Net project?

466