Q
Which jQuery method is used to change the background color of all paragraphs to yellow?

Answer & Solution

Answer: Option A
Solution:
$('p').css('background-color', 'yellow');
Related Questions on Average

Which jQuery method is used to change the height of all <div> elements to 200 pixels?

A). $('div').height('200px');

B). $('div').setHeight('200px');

C). $('div').css('height', '200px');

D). $('div').style('height', '200px');

How to change the font family of all<p> elements to 'Arial' using jQuery?

A). $('p').style('font-family', 'Arial');

B). $('p').fontFamily('Arial');

C). $('p').css('font-family', 'Arial');

D). $('p').font('Arial');

How to change the color of all paragraphs to red using jQuery?

A). $('p').style('color', 'red');

B). $('p').css('color', 'red');

C). $('p').color('red');

D). $('p').setColor('red');

How to change the alt attribute of all <img> elements to 'New Image' using jQuery?

A). $('img').alt('New Image');

B). $('img').setAttribute('alt', 'New Image');

C). $('img').attr('alt', 'New Image');

D). $('img').setAttr('alt', 'New Image');

Which jQuery method is used to change the font weight of all<h2> elements to bold?

A). $('h2').style('font-weight', 'bold');

B). $('h2').fontWeight('bold');

C). $('h2').css('font-weight', 'bold');

D). $('h2').bold();

How to change the font color of all <span> elements to blue using jQuery?

A). $('span').fontColor('blue');

B). $('span').color('blue');

C). $('span').css('color', 'blue');

D). $('span').style('color', 'blue');

Which jQuery method is used to change the background image of all <div> elements?

A). $('div').bgImage('url(image.jpg)');

B). $('div').css('background-image', 'url(image.jpg)');

C). $('div').background('url(image.jpg)');

D). $('div').setImage('url(image.jpg)');

Which jQuery method is used to change the HTML content of all <div> elements?

A). $('div').innerHtml('

New paragraph

');

B). $('div').html('

New paragraph

');

C). $('div').innerHTML('

New paragraph

');

D). $('div').setContent('

New paragraph

');

How to change the font size of all elements to 16 pixels using jQuery?

A). $('span').style('font-size', '16px');

B). $('span').fontSize('16px');

C). $('span').css('font-size', '16px');

D). $('span').font('16px');