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> <html> <head> <title>Chapter 3 :: AJAX & JSON</title> <script src="jquery.min.js"></script> <script> </script> </head> <body></body> </html>
Ensure that you update the reference to the jQuery library to ...
Get jQuery 2.0 Development Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.