Answer & Solution
$('a').removeAttr('href');
$('a').removeAttr('href');
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 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 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');
How to remove the class 'hidden' from all elements with the class 'element' using jQuery?
A). $('.element').removeClass('hidden');
B). $('.element').remove('hidden');
C). $('.element').deleteClass('hidden');
D). $('.element').removeClassName('hidden');
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');
Which jQuery method is used to change the width of all <div>
elements to 300 pixels?
A). $('div').width('300px');
B). $('div').setWidth('300px');
C). $('div').css('width', '300px');
D). $('div').style('width', '300px');
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;
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)');
How to change the src attribute of an<img>
element using jQuery?
A). $('img').attr('src', 'newimage.jpg');
B). $('img').src = 'newimage.jpg';
C). $('img').setAttribute('src', 'newimage.jpg');
D). $('img').srcAttr('newimage.jpg');
Which jQuery method is used to change the HTML content of all <div>
elements?
A). New paragraph$('div').innerHtml('
B). New paragraph$('div').html('
C). New paragraph$('div').innerHTML('
D). New paragraph$('div').setContent('