Not understanding .Alternate way to display search term photo not working
why does Instead of defining
var $searchField = $('#search');
var animal = $searchField.val();
you can't simply do
var animal = $('#search').val()
It does not work?
Mikkel Rasmussen31,768 Points
Its should work maybe its because you are missing a semi colon?
var animal = $('#search').val();
You would use the two separate variables if you needed to access the actual element as a jQuery object for something else (like changing the value later, adding/changing classes, etc).
But otherwise, yes, your code is a little shorter.