JavaScript AJAX Basics (retiring) AJAX and APIs Stage 4 Challenge Answer

Peter Retvari
Peter Retvari
Full Stack JavaScript Techdegree Student 8,392 Points

Delete the photos and the search-field on focus or user click

Hi Folks,

I did the small challenge at the end as well about the search-field vs. photos:

   //on userclick or focus make the searchfield cleared and delete the photos
   $searchField.on ('click focusin', function (){
      this.value = '';
      if ($searchField.val().length === 0){
      $('#photos').html('');
      }
   });

Hope it helps for someone.