Q:

a:not[href^=".."] ("Does Not Start With" operator) not working

I have a bunch of A-links organized as follows,
div class="thumbnail_wrap">
    <a href="photos/2014/1.png">..</a>
    <a href="photos/2014/2.png">..</a>
    <a href="photos/2015/1.png">..</a>
    <a href="photos/2016/1.png">..</a>
     ..
</div>

I need to select all links corresponding to a certain year contained in var year
alert('Year selected: ' + year + ' ' + 
      'Photos in this section: ' + 
      $('.thumbnail_wrap > a[href^="photos/' + year + '"]').length + ' ' + 
      'Photos NOT in this section: ' + 
      $('.thumbnail_wrap > a:not[href^="photos/' + year + '"]').length   );

// Find all images with the "/photos/<YEAR>" URL and make them visible
$('.thumbnail_wrap > a[href^="photos/' + year + '"]').show();
// Find all images with the wrong Year URL and make them hidden
$('.thumbnail_wrap > a:not[href^="photos/' + year + '"]').hide();

The first expression always works. But the a:not expression does not work. Getting this error,
TypeError: a is undefined  jquery-1.10.2.js

A:

$('.thumbnail_wrap > a:not([href^="photos/' + year + '"])').hide();

You need to add brackets around the selector

