title: how to display JSON data using jQuery .filter() method
body: <p>I am creating a page having some images, details and a search input option via JSON object. 
  My problem is when I use search option it doesn't show any result. However it shows data on the page from JSON in normal condition.</p>
  
  <p>I have tried other post as well but no luck.</p>
  
  <p><a href="https://stackoverflow.com/questions/10679580/javascript-search-inside-a-json-object">Javascript search inside a JSON object</a></p>
  
  <p><strong>html code:</strong></p>
  
  <pre><code>&lt;div class="wrapper"&gt;
              &lt;div class="header"&gt;Logo Name&lt;/div&gt;
              &lt;div class="middle"&gt;
                  &lt;div id="results"&gt;&lt;/div&gt;
                  &lt;div class="leftContainer"&gt;
  
                  &lt;/div&gt;
                  &lt;div class="rightContainer"&gt;
                      &lt;input type="text" id="inputText" /&gt;&amp;nbsp;&amp;nbsp;&lt;input type="button" id="button" value="Search Data" /&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="footer"&gt;
                  &amp;copy; 2013 ABC. All rights reserved.
              &lt;/div&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p><strong>jQuery code:</strong>
  below #button click will display the data.</p>
  
  <pre><code>$(document).ready(function(){        
      $.getJSON('assets/js/sample.json', function(data){
          var items = [];
  
          $.each(data.latest, function() {
              items.push("&lt;h2&gt;" + this['thumbTitle'] + "&lt;/h2&gt;");
              items.push("&lt;ul&gt;&lt;li&gt;" + this['thumbSmall'] + "&lt;/li&gt;&lt;/ul&gt;");
              items.push("&lt;p&gt;" + this['description'] + "&lt;/p&gt;");
          });
  
          $('&lt;div /&gt;', {
             html: items.join('')
              }).appendTo('.leftContainer');
  
          $('#button').on('click', function(data, name) {                                       
  
  
              name = $('#inputText').val().toUpperCase();
              alert(name);  
              var results;
              results = data.latest.filter(function() {
                  return data.latest.name.toUpperCase().indexOf(name) !== -1;
              });
              return $('#results').innerHTML() = results;
              console.log(results);
          });
     });
  });
  </code></pre>
  
  <p><strong>JSON data:</strong></p>
  
  <pre><code>{
      "latest"    :[
                      { 
                          "thumbTitle":"Image Title1",
                          "thumbSmall" : ["&lt;img src='assets/images/thumb1.jpg' alt='' /&gt;", "&lt;img src='assets/images/thumb2.jpg' alt='' /&gt;"],
                          "description" : "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries."
                      }, 
                      { 
                          "thumbTitle":"Image Title2",
                          "thumbSmall" : ["&lt;img src='assets/images/thumb3.jpg' alt='' /&gt;", "&lt;img src='assets/images/thumb2.jpg' alt='' /&gt;", "&lt;img src='assets/images/thumb4.jpg' alt='' /&gt;", "&lt;img src='assets/images/thumb1.jpg' alt='' /&gt;"],
                          "description" : "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout."
                      }, 
                      { 
                          "thumbTitle":"Image Title3",
                          "thumbSmall" : ["&lt;img src='assets/images/thumb3.jpg' alt='' /&gt;", "&lt;img src='assets/images/thumb2.jpg' alt='' /&gt;"],
                          "description" : "There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable."
                      }, 
                      { 
                          "thumbTitle":"Image Title4",
                          "thumbSmall" : ["&lt;img src='assets/images/thumb1.jpg' alt='' /&gt;"],
                          "description" : "The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham."
                      }
      ]
  }
  </code></pre>