jQuery Online Test Questions part 4

19. To select all the elements in the page which symbol do we have to used?

a. #
b. $
c. !
d. *

Answer: d. *

Explanation: The '*' symbol is used to select all the elements in the page.


20. $('#pcds').attr('disabled', true); these code is used for the disable form element.

a. True
b. False

Answer: a. True

Explanation: The above statement is true. The $('#pcds').attr('disabled', true); these code is used for the disable form element.


21. There are two ways in JQuery to change the width of the element.

a. True
b. False

Answer: a. True

Explanation: The above statement is true. There are two ways in JQuery to change the width of the element.

First you can use the .css() method passing in the first parameter as height or width and the second parameter being the value. For example,
$('.element').css('height', new_height_value);
$('.element').css('width', new_width_value);

And, second you can use the .height() method and the .width() method. For example,
$('.element').height(new_height_value);
$('.element').width(new_width_value);


22. Which method is provided by the jquery to create our own custom animation with fine-grained control?

a. .animation()
b. stopPropagation()
c. .toggle()
d. .animate()

Answer: d. .animate()

Explanation: JQuery provides a powerful .animate() method that allows us to create our own custom animations with fine-grained control.


23.  jQuery ______method is used to set/return arbitrary data to/from an element.

a. .data()
b. .item()
c. .all
d. All of these

Answer: a. .data()

Explanation: JQuery provides .data() method which is used to set/return arbitrary data to/from an element.


24. Multiple javascript library coexist on single page using _______ .

a. conflict()
b. noConflict()
c. unbind()
d. die()

Answer: b. noConflict()

Explanation: Multiple javascript library coexist on single page using noConflict(). This method releases the hold on the $ shortcut identifier, so that other scripts can use it. The noConflict() method returns a reference to jQuery, that you can save in a variable, for later use.