jQuery App - 1
.add()
by Dipak1991
HTML
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<div>
<span>Span</span>
<p>Para</p>
</div>
JavaScript
/*
Agenda -
Color span and p tags with yellow color & spans' text color should be red
One way is apply color to both individually like,
$('p').css( "background", "yellow" );
$('span').css( { 'background': 'yellow', 'color': 'red' } );
Other way is to use .add method and perform the action on both elements simultaneously.
*/
$(function () {
$('span')
.css("color", "red") // select all span tags and apply red color to text
.add('p') // now also select all p tags. Now I have [span, p]
.css("background", "yellow"); // color them both
});