Possible Duplicate:
How to find index of object in a JavaScript array with jQuery
I need to find value of input entered if already exists in .data() function.
I am trying this way.
jQuery
var array = $("form[name=update]").data("values", {"v1": "value1", "v2": "value2", "v3": "value3", "v4": "value4", "v5": "value5"});
if ($.inArray("value1", array) > -1){alert("duplicate value")}
But it does nothing.
Please see and suggest any possible way to do this.
Thanks.
Here
grep(which does not do objects) did not work for me either.Here is a $.each version
DEMO
This is now I had a look, the same method as danronmoon’s solution
DEMO