Answer & Solution
$('span').css('color', 'blue');
<span>
elements to blue using jQuery?
$('span').css('color', 'blue');
Which jQuery method is used to change the background color of all paragraphs to yellow?
A). $('p').css('background-color', 'yellow');
B). $('p').style('background-color', 'yellow');
C). $('p').bgColor('yellow');
D). $('p').background('yellow');
Which jQuery method is used to set the value of the title attribute to 'New Title' for all elements?
A). $('a').attr('title', 'New Title');
B). $('a').title('New Title');
C). $('a').setAttribute('title', 'New Title');
D). $('a').titleAttr('New Title');
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');
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 text content of all <h1>
elements to 'New Heading' using jQuery?
A). $('h1').html('New Heading');
B). $('h1').textContent = 'New Heading';
C). $('h1').text('New Heading');
D). $('h1').innerText('New Heading');
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 add the class 'active' to all<li>
elements within a<ul>
using jQuery?
A). $('ul li').setAttribute('class', 'active');
B). $('ul li').add('active');
C). $('ul li').addClass('active');
D). $('ul li').setAttribute('class', 'active');
Which jQuery method is used to add the class 'highlight' to all <div>
elements?
A). $('div').addClass('highlight');
B). $('div').class('highlight');
C). $('div').attr('class', 'highlight');
D). $('div').applyClass('highlight');
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 opacity of all <div>
elements to 0.5?
A). $('div').setOpacity(0.5);
B). $('div').opacity(0.5);
C). $('div').css('opacity', 0.5);
D). $('div').opacity = 0.5;