Searching JavaScript objects

With objects being the main method of holding data within your application, it can be very useful to be able to find objects matching a certain criteria. jQuery does not provide a direct method for us to search through objects and arrays of objects; however, we can easily create this functionality.

Getting ready

Using your favorite text editor, create a blank HTML document named recipe-4.html, and ensure that you have the latest version of jQuery installed. Add the following HTML code to this HTML file:

<!DOCTYPE html>
  <title>Chapter 3 :: AJAX & JSON</title>
  <script src="jquery.min.js"></script>


Ensure that you update the reference to the jQuery library to ...

Get jQuery 2.0 Development Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.