Return true if the Gimme Object's underlying array contains the specified item, false otherwise.

Returns: either true or false.
  • item, required: The item being sought from the Gimme Object's underlying array.

// Use Gimme to search a normal array
if (g(['Steve', 'Emily', 'Guinness', 'Anna', 'Madeline', 'Jonah', 'Gabriel']).contains('Anna'))
	alert('The array contains "Anna"');

// Search a Gimme Object for a particular element
var steve = document.getElementById('steve');
if (g('div.person').contains(steve))
	alert('The collection of all <div> elements with the class "person" does contain the element #steve');

Last edited Nov 13, 2007 at 9:46 PM by sstchur, version 1


No comments yet.