jQuery Multiple choices


Total available count: 24
Subject - JavaScript Frameworks
Subsubject - jQuery

Which jQuery method is used to set one or more style properties for selected elements?


 

 

 

 



A


Solution:-

Definition and Usage
The CSS() method is used to sets or returns one or more style properties for the selected elements.

When used to return properties:
This method returns the specified CSS property value of the FIRST matched element. However, shorthand CSS properties (like "background" and "border") are not fully supported and may give different results in different browsers.

When used to set properties:
This method sets the specified CSS property for ALL matched elements.

Syntax
Return the CSS property value:

$(selector).css(property);

Set the CSS property and value:

$(selector).css(property,value);

Set CSS property and value using a function:

$(selector).css(property,function(index,currentvalue));

Set multiple properties and values:

$(selector).css({property:value, property:value, ...});

Example
Set the color property of all <p> elements:

$("button").click(function(){
 $("p").css("color", "red");
});

 




Next 5 multiple choice(s)

1

Which jQuery method is used to perform an asynchronous HTTP request?

2

What is the correct jQuery code for making all div elements 100 pixels high?

3

What scripting language is jQuery written in?

4

Which jQuery function is used to prevent code from running, before the document is finished loading?

5

Which jQuery method should be used to deal with name conflicts?

Comments