When selecting elements in jQuery you sometimes want to reuse the selection again later on in your code. A jQuery selection basically is searching your DOM for specific elements based on what you specify inside of $().
$('#YourSelection').text('Change Text!'); $('#YourSelection').css('color','red');
1 2 3
var yourSelection = $('#YourSelection'); yourSelection.text('Change Text!'); yourSelection.css('color','red');
As Reddit user isometriks pointed out; best practice for the above code would be to chain these two actions together avoiding the necessity of caching the selection. However, anytime you need to call the same selection more than once you should cache the selection.
var yourSelection = $('#YourSelection'); yourSelection.text('Change Text!').css('color','red');